Skip to content
This repository has been archived by the owner on Oct 20, 2022. It is now read-only.

Latest commit

 

History

History

send_an_email

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
id title brief article
9D90FCAD-FB7B-D4C0-C65E-8EC2364FFC52
Send an Email
This recipe shows how to send an email using an Intent.

Recipe

Follow these steps to send an email.

  • Create an Intent with an ActionSend action.
var email = new Intent (Android.Content.Intent.ActionSend);
  • Add email extras to the intent’s payload.
email.PutExtra (Android.Content.Intent.ExtraEmail,
new string[]{"person1@xamarin.com", "person2@xamrin.com"} );

email.PutExtra (Android.Content.Intent.ExtraCc,
new string[]{"person3@xamarin.com"} );

email.PutExtra (Android.Content.Intent.ExtraSubject, "Hello Email");

email.PutExtra (Android.Content.Intent.ExtraText,
"Hello from Xamarin.Android");
  • Set the intent’s mime type to message/rfc822.
email.SetType ("message/rfc822");
  • Start the Activity with the intent;
StartActivity (email);

Additional Information

Setting the intent’s mime type to message/rfc822 causes the mail application to launch. If multiple applications are capable of handling mail, the user will get a list to choose from.