Hello, Earlier it was very easy task to send mail from your app in windows phone 8 by just using the EmailComposeTask but it has been removed in windows phone 8.1. In windows phone 8.1 there is an EmailManager , by using this we can send mail in windows phone 8.1. So lets start to write code for this. First of all add a Button in your windows phone 8.1 project and in its event write the following line of code:
private async void sendMailButton_Click(object sender, RoutedEventArgs e) { //Adding the address to which we have to send the mail EmailRecipient mailTo = new EmailRecipient { //Email address of the Recipient Address="[email protected]" };
EmailMessage message = new EmailMessage(); message.Subject = "WP 8.1 Email Task"; message.Body = "Sending my first mail from Windows Phone 8.1";
message.To.Add(mailTo); //we can also add cc as well as bcc //message.CC.Add(mailTo); // message.Bcc.Add(mailTo);
AmanPosted Oct 10, 2014, 2:39 PM
Earlier it was very easy task to send mail from your app in windows phone 8 by just using the EmailComposeTask but it has been removed in windows phone 8.1.
In windows phone 8.1 there is an EmailManager , by using this we can send mail in windows phone 8.1.
So lets start to write code for this. First of all add a Button in your windows phone 8.1 project and in its event write the following line of code:
private async void sendMailButton_Click(object sender, RoutedEventArgs e)
{
//Adding the address to which we have to send the mail
EmailRecipient mailTo = new EmailRecipient
{
//Email address of the Recipient
Address="[email protected]"
};
EmailMessage message = new EmailMessage();
message.Subject = "WP 8.1 Email Task";
message.Body = "Sending my first mail from Windows Phone 8.1";
message.To.Add(mailTo);
//we can also add cc as well as bcc
//message.CC.Add(mailTo);
// message.Bcc.Add(mailTo);
await EmailManager.ShowComposeNewEmailAsync(message);
}
I am including the Source code also, you can download it.
If it helps you then please Accept it as Answer.
priya AvanigaddaPosted Oct 28, 2014, 8:46 AM