Send Email to Multiple Addresses Android

后端 未结 3 440
感动是毒
感动是毒 2021-02-06 08:07

I want to select a number of email addresses and then send an email to all of them.

My code is as below:

emailIntent .putExtra(android.content.Intent.EXT         


        
3条回答
  •  囚心锁ツ
    2021-02-06 08:37

    If you having the list of email addresses seprated by , then split that string to get individual email id as follow:
    String [] emailList = emailAddresses.split(",");
    now use emailList with your Intent.EXTRA_EMAIL key,as this will show all email addresses inside to field of send email form.

    How about this code:

    final Intent emailLauncher = new Intent(Intent.ACTION_SEND_MULTIPLE);
    emailLauncher.setType("message/rfc822");
    emailLauncher.putExtra(Intent.EXTRA_EMAIL, emailList);
    emailLauncher.putExtra(Intent.EXTRA_SUBJECT, "check this subject line");
    emailLauncher.putExtra(Intent.EXTRA_TEXT, "hey check this message body!");
    try{
           startActivity(emailLauncher);
    }catch(ActivityNotFoundException e){
    
    }
    

提交回复
热议问题