Sending Email with attachment RRS feed

  • Question

  • I run my app with below code  in Simulator mode in VS

    var mailto = new Uri("mailto:?to=recipient@xyz.com&subject=using Email&body=Hi.");

    await Windows.System.Launcher.LaunchUriAsync(mailto);


    1) The Email client freeze or stopped after showing the launch-page with Envelop-icon. It did not show TO, Subject and Body for above code.

    2) When I tested in LocalMachine Mode, it is working. When I right click it, it popup the bottom par with a few icons such as Attchment icon.

    a) Can I send attachment in Surface ?


    Thursday, August 29, 2013 2:01 AM


  • There is no direct way to send email to a specific address with an attachment. In most cases you are better off either using the share contract and letting the user choose the recipient or calling a web service directly rather than going through email. The other option (not generally recommended unless you're writing an email client) is to connect to the email servers directly via their API.

    A mailto: URI will launch the user's default mail client. The launching app cannot control which mail client that is. How the mail client interprets the URI is up to the client and not all clients will implement all headers. I am not aware of any which accept attachment headers. It is possible there may be some, but the launching app cannot depend on the user choosing such an app as a default.

    A more typical version of your mailto: URI would include just the recipient as the primary response rather than including it in the "to" header.

    mailto:user@example.com?subject=Message Title&body=Message Content

    Using the "to" header is explicitly called out as allowed by the RFC, but is less likely to be implemented. See http://msdn.microsoft.com/en-us/library/aa767737(v=VS.85).aspx and RFC2368: The mailto URL scheme

    I'm not sure why the email client didn't launch on your simulator, but that wouldn't be related to the way the app actually launched the mailto: URI. I suspect you'll see similar problems if you launch the mailto: URI from within IE on that system.


    • Proposed as answer by Oleg Kurzov Thursday, August 29, 2013 4:59 AM
    • Marked as answer by Anne Jing Tuesday, September 3, 2013 1:30 PM
    Thursday, August 29, 2013 2:25 AM