Send an Email

PDF for offline use
Sample Code:
Related Articles:

Let us know how you feel about this

Translation Quality


0/250

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.

Xamarin Workbook

If it's not already installed, install the Xamarin Workbooks app first. The workbook file should download automatically, but if it doesn't, just click to start the workbook download manually.