How to Programatically Send Email with attachments in Windows Phone 8.1 using C# ?

Published on May 1, 2014 by abundantcode

Filed under Windows Phone

Last modified May 1, 2014

Print this page

rate 1 star rate 2 star rate 3 star rate 4 star rate 5 star
Your rating: none, Average: 0 (0 votes)

This article have been viewed 4812 times

Below is a sample code snippet that demonstrates how to send email with attachments programmatically in Windows Phone 8.1 using C# .

How to Programatically Send Email with attachments in Windows Phone 8.1 using C# ?

EmailMessage objEmail = new EmailMessage();
objEmail.Subject = "Abundantcode Article";
var localAppFolder = Windows.Storage.ApplicationData.Current.LocalFolder;
var fileHandle = await localAppFolder.CreateFileAsync("AbundantcodeData.txt", Windows.Storage.CreationCollisionOption.ReplaceExisting);
objEmail.Attachments.Add(new EmailAttachment(fileHandle.Name, fileHandle));
await EmailManager.ShowComposeNewEmailAsync(objEmail);
If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

3 Comments

  1. Madhukar

    What is the maximum size of the attachment? and What is the max list size in Attachments?

    May 7, 2014 - 2:18 pm – Reply

  2. Xoot

    Thanks for this. I get a System.NotImplementedException when I call await EmailManager.ShowComposeNewEmailAsync(objEmail); but the app’s target is WP8.1 and am building to 8.1 emulator. Any idea why?

    June 1, 2014 - 3:20 pm – Reply

  3. cool_php

    Hi,
    I know it is a stupid question. Can you please tell me how can i import EmailMessage class?. No way i am able to load this class. I have imported
    using Microsoft.Phone.Tasks;
    using System.Net.Mail;
    using System.Net.Mime;

    But no luck. Can you please help me.

    Thanks

    November 15, 2014 - 10:27 am – Reply

Leave a Comment


x

You might be Interested in these Posts

How to delete user account from command line in Windows 10 ?

You can delete a user account from command line in Windows 10 using the net user command and specify...

How to add new user account from command line in Windows 10 ?

You can add a new user account in Windows 10 using command prompt using the net user command and pas...

How to open display settings from command line in Windows 10 ?

The display properties can be found in the settings app in Windows 10 which lets the users to config...