连接到 POP3 服务器

发布于 2024-07-09 05:38:14 字数 58 浏览 6 评论 0原文

.NET 是否有办法从开箱即用的 POP3 服务器中提取电子邮件,或者您必须编码/购买第 3 方组件?

Does .NET have a way to pull email from a POP3 server out of the box or you have to code/buy a 3rd party component?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

薄荷港 2024-07-16 05:38:14

你可以检查Mail.dll .NET邮件组件,它有SSL支持,unicode和多国电子邮件支持:

using(Pop3 pop3 = new Pop3())
{
    pop3.Connect("mail.host.com");      // Connect to server
    pop3.Login("user", "password");

    foreach(string uid in pop3.GetAll())
    {
        IMail email = new MailBuilder()
            .CreateFromEml(pop3.GetMessageByUID(uid));
          Console.WriteLine( email.Subject );
    }
    pop3.Close(false);      
}

您可以在此处下载:http://www.limilabs.com/mail

You can check Mail.dll .NET mail component, 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");

    foreach(string uid in pop3.GetAll())
    {
        IMail email = new MailBuilder()
            .CreateFromEml(pop3.GetMessageByUID(uid));
          Console.WriteLine( email.Subject );
    }
    pop3.Close(false);      
}

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

爱本泡沫多脆弱 2024-07-16 05:38:14

第 3 方组件是最佳选择; 比使用 NetStreams 发送原始 POP3 命令的替代方案好得多 [颤抖]

3rd party components are the way the go; much better than the alternative, which would be sending raw POP3 commands with NetStreams [shudder]

北座城市 2024-07-16 05:38:14

查看 Quiksoft 中的 EasyMail 对象。 它们非常易于使用并且支持非常好。

Check out the EasyMail objects from Quiksoft. They are very easy to use and the support is really good.

美人如玉 2024-07-16 05:38:14

我个人喜欢serverintellect 组件

I personally like the serverintellect components.

任谁 2024-07-16 05:38:14

.NET框架不支持POP3。

连接到 POP3 服务器是一个简单的工作。 该协议非常简单。 这
问题是消息的正确解析。 您需要一个像样的 MIME 或 S/MIME 解析器,它可以处理 unicode、vierd 格式的附件、Outlook 生成的非标准 WinMail.dat 中的邮件正文、国际化问题。 一个解析器,可以修复常见的邮件客户端错误和 RFC 违规等。有相当多的第三方 POP3 库。 codeproject 上还有一些免费的 POP3 库

您可以尝试我们的 Rebex POP3 for .NET

// create client, connect and log in  
Pop3 client = new Pop3();
client.Connect("pop3.example.org");
client.Login("username", "password");

// get message list - full headers  
Pop3MessageCollection messages = client.GetMessageList(Pop3ListFields.FullHeaders);

// display info about each message  
Console.WriteLine("UID | From | To | Subject");
foreach (Pop3MessageInfo message in messages)
{
    Console.WriteLine
    (
        "{0} | {1} | {2} | {3}",
        message.UniqueId,
        message.From,
        message.To,
        message.Subject
    );
}

client.Disconnect();

代码取自www.rebex.net/secure-mail.net/tutorial-pop3.aspx

the .NET framework does not support POP3.

Connection to the POP3 server is an easy part of work. The protocol is pretty easy. The
problem is correct parsing of the message. You'll need a decent MIME or S/MIME parser which can handle unicode, attachments in vierd formats, message body in nonstandard WinMail.dat produced by Outlook, internationalization issues. A parser which can fix common mail clients bugs and RFC violations etc.. Threre is quite a lot of third party POP3 libraries. There are also some free POP3 libraries on codeproject.

You may try our Rebex POP3 for .NET

// create client, connect and log in  
Pop3 client = new Pop3();
client.Connect("pop3.example.org");
client.Login("username", "password");

// get message list - full headers  
Pop3MessageCollection messages = client.GetMessageList(Pop3ListFields.FullHeaders);

// display info about each message  
Console.WriteLine("UID | From | To | Subject");
foreach (Pop3MessageInfo message in messages)
{
    Console.WriteLine
    (
        "{0} | {1} | {2} | {3}",
        message.UniqueId,
        message.From,
        message.To,
        message.Subject
    );
}

client.Disconnect();

Code is taken from www.rebex.net/secure-mail.net/tutorial-pop3.aspx

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文