Receiving email and downloading attachment through a C# Application

后端 未结 4 1965
再見小時候
再見小時候 2021-02-02 16:44

I am trying to implement a WPF application which can receive the mails sent to a specific email address. The scenario is that, the user will send a PPT file as an attachment to

相关标签:
4条回答
  • 2021-02-02 17:12

    There is simply no reason to use anything besides MailKit. It's free to use under MIT Licence, frequently updated since 2014 and as easy to use as a Mail Client.

    0 讨论(0)
  • 2021-02-02 17:19
    var client = new POPClient();
    client.Connect("pop.gmail.com", 995, true);
    client.Authenticate("admin@bendytree.com", "YourPasswordHere");
    var count = client.GetMessageCount();
    Message message = client.GetMessage(count);
    Console.WriteLine(message.Headers.Subject);
    

    A simple tip, that you can follow: https://joshwright.com/tips/tips-sending-receiving-email-in-csharp/

    0 讨论(0)
  • 2021-02-02 17:24

    You can use POP3 or IMAP to check for email messages and then process the email message for saving the attached .ppt file. Click here for a sample.

    0 讨论(0)
  • 2021-02-02 17:33

    Since the various links in the other answers don't work anymore, here are 2 links to articles I wrote on CodeProject how to download emails received from POP3 servers like Gmail:

    POP3 Email Client
    POP3 Email Client with full MIME Support

    The code has been downloaded over 10000 times, but is too big to be posted here.

    0 讨论(0)
提交回复
热议问题