Integrating POP3 client functionality into a C# application?

前端 未结 15 1486
忘掉有多难
忘掉有多难 2020-12-07 09:39

I have a web application that requires a server based component to periodically access POP3 email boxes and retrieve emails. The service then needs to process the emails whi

15条回答
  •  鱼传尺愫
    2020-12-07 10:17

    You may want to include Mail.dll .NET mail component in your ranking. It has SSL support, Unicode, and multi-national email support:

    using(Pop3 pop3 = new Pop3())
    {
        pop3.Connect("mail.host.com");      // Connect to server
        pop3.Login("user", "password");     // Login
    
        foreach(string uid in pop3.GetAll())
        {
            IMail email = new MailBuilder()
       .CreateFromEml(pop3.GetMessageByUID(uid));
    
            Console.WriteLine(email.Subject);
        }
        pop3.Close(true);  
    }
    

    IMAP protocol is also supported.

    Please note that this is a commercial product I've created.

    You can download it here: http://www.lesnikowski.com/mail

提交回复
热议问题