Send Email Task in Windows Phone 8.1

In this post I will show you how to compose and sent an email from you Windows Phone 8.1 app. If you are developing a Windows Phone 8 Silverlight application then you could refer to our other post.
Launchers and choosers – Email Tasks in Windows phone app

The APIs have changed for WinRT applications. Here’s the code that can be used to send email using a Windows Phone 8.1 WinRT application.

// Define Recipient
EmailRecipient sendTo = new EmailRecipient()
{
    Address = "maskaravivek@gmail.com"
};

// Create email object
EmailMessage mail = new EmailMessage();
mail.Subject = "Hello world";
mail.Body = "Email Body";

mail.To.Add(sendTo);
// Open the share contract with Mail only:
await EmailManager.ShowComposeNewEmailAsync(mail);

We are using an EmailRecipient object that contains the email address of the person to whom we wish to send an email. Then we create an object of EmailMessage class and set its Subject and Body. Also we add the all the recipients to the To list. Finally we call ShowComposeNewEmailAsync asyncronously to launch the email app.

Vivek Maskara

I am pursuing BTech in Software Engineering from Delhi Technological University. I develop apps, create websites and blog about my app experiences.

Read more:
How to create your first Windows Phone app
How to change the App name and Tile name of your Windows phone app
Data binding in Windows Phone app – One way binding
Close