Wednesday, 1 August 2012

How to send an email in Windows 8 C#/XAML metro app

Windows 8 Metro app: How to send an email

In a Windows Phone 7 app, sending an email requires an instance of EmailComposeTask. EmailComposeTask is really easy to use and self-explanatory:

In Windows 8 Metro app, there’s no EmailComposeTask. Instead, you create a “mailto” –uri and launch it:
But when compared to an EmailComposeTask, this only fills the “To” –part, but what about the “Subject” and “Body”? Well, the mailto-syntax allows you to define these as query parameters. For example, here’s an example of defining the “subject”, “body” and “to” –fields from code. The uri is automatically escaped by the platform:

var mailto = new Uri("mailto:? subject of an email&body=Hello from a Windows 8 Metro app.");
await Windows.System.Launcher.LaunchUriAsync(mailto);

Read full article here


  1. I have Tried This Code but i have to click on Send Button At Last .is There any way by which i can send it directly without clicking in the send button in the application.

    Vimal Bhavsar

  2. Hi Vimal,

    In WinRT framework due to security reason and to stop spamming of emails, it has been restricted to send emails from code behind.

    1. Thanx Farhan ,
      So is there no any way to send email automatically in windows 8 application?in my application i have to do code like this because i Develop automatically Email sending Application .if you find any other solution then please reply me ....

      thnx for your help////

  3. Thanks Farhan. I tried the code and it worked fine.

    Kind Regards

  4. hi farhan do you know how to put new line in subject of mail ?

    I tried with addinf "/n" but it is not working . If you have any idea please let me know.


  5. Try this "mailto:? subject of an email&body=This is first line%0D%0AThis is new line." You have to use "%0D%0A" in place of "\n"

  6. Yep... for security reasons and to avoid spamming, TCP/IP connections and any network usage in general will also be restricted soon... This "security" restrictions suck and put Microsoft and Win8/RT well behind competition.


Web Informer Button