Wednesday, October 17, 2012

Send an email in WinRT

Sending emails in WinRT is easy, you only have to create a “mailto” –uri and launch it:
var mail = new Uri("mailto:test@somedomain.com"); 
await Windows.System.Launcher.LaunchUriAsync(mail);

If you also want to define a subject, body or other fields, you can further extend the querystring:
var mail = new Uri("mailto:?to=test@somedomain.com&subject=Some subject&body=Some other content."); 
await Windows.System.Launcher.LaunchUriAsync(mail);
That’s all. Not the most programmer friendly interface, but it works…

1 comment:

Anonymous said...

How can you specify attachments?