locked
How to implement a function of sending mail in my app?? RRS feed

  • Question

  • Hello everyone :

    I now meet a problem with sending E-mail in Metro APP.It is deserve to be mentioned that I just need to send an E-mail to an E-mail address , and don't expect to recive any mail.

    So please tell me , how it can be implemented.Is there a class like "System.Net.Mail" in Metro API (win8 RP & vs2012RC)? If not , may be MicroSoft Windows 8 Metro APP Mail provide some interfaces or components I can use.

    Or I must to code by myself with low level socket?

    I don't want to implement with "Sharing and exchanging data".

    Please tell me the answer. Thanks a lot.

    Monday, June 18, 2012 8:40 AM

Answers

  • If the goal is to send to a specific address then launching a mailto: is generally your best bet. If you want to let the user choose where to send it then you should use the Sharing contract so the user can choose any of their communication apps.

    If you have more specific needs then you would need to implement that yourself by talking to your mail web service, opening a socket to the SMTP port, etc.

    --Rob

    • Marked as answer by FieryBoy Thursday, June 21, 2012 3:53 AM
    Wednesday, June 20, 2012 7:03 PM
    Moderator

All replies

  • I don't think there is such functionality, all you can do is to share the file or text that you want to send using the share contract and let the user chose the Mail App. (Sharing Contracts)

    You can follow the long lasting thread here: How to send email with WinRT


    Can Bilgin
    Blog CompuSight


    • Edited by Can Bilgin Monday, June 18, 2012 9:35 AM typo
    Monday, June 18, 2012 9:35 AM
  • Thanks for your answer.

    But we really don't want to implement this function use Sharing Contracts,cause we just want user to input some data and click "send",just so simple.Users don't have to click more than one time ,and they don't have to face a more complicated UI.All we want is to provide to users a simple using experience.

    Monday, June 18, 2012 9:59 AM
  • i guess the best you can do at this point, try porting the simplest open-source smtp client to WinRT. (as it seems). You would probably make a lot people happy :)

    Can Bilgin
    Blog CompuSight

    Tuesday, June 19, 2012 8:36 AM
  • You may use the "mailto:" protocol as I suggested here:

    metro app sending email

    http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/809de529-f369-455b-8f38-ee58dd04cfc9


    --------------------------------------------------------------------------------

    Alejandro Campos Magencio - Microsoft Escalation Engineer - Forum Moderator
     If my reply answers your question, please mark this post as answered.

    Wednesday, June 20, 2012 12:48 PM
    Moderator
  • If the goal is to send to a specific address then launching a mailto: is generally your best bet. If you want to let the user choose where to send it then you should use the Sharing contract so the user can choose any of their communication apps.

    If you have more specific needs then you would need to implement that yourself by talking to your mail web service, opening a socket to the SMTP port, etc.

    --Rob

    • Marked as answer by FieryBoy Thursday, June 21, 2012 3:53 AM
    Wednesday, June 20, 2012 7:03 PM
    Moderator
  • Thanks everyone!

    I now decided to code by using socket , and I'm writing indeed,though I facing a lot of problem.

    Thursday, June 21, 2012 3:53 AM
  • good luck, maybe you can open a discussion thread or a codeplex project, i am sure there are a lot of people ready to help...

    Can Bilgin
    Blog CompuSight

    Thursday, June 21, 2012 5:08 AM