ASP.NET:如何使用 POP3 下载电子邮件附件?

发布于 2024-08-18 13:59:55 字数 103 浏览 2 评论 0原文

我正在建立一个电子邮件接收网站。我可以借助代码项目中使用的代码阅读电子邮件,但无法下载电子邮件附件。

谁能告诉我如何使用 POP3 下载电子邮件附件?

谢谢你!

I am building an email receiving website. I can read the email with the help of code used in Code Project, but I can't download email attachments.

Can anyone tell me how to download email attachments using POP3?

Thank you!

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

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

发布评论

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

评论(2

赴月观长安 2024-08-25 13:59:55

在我的一个项目中,我使用了一个商业服务器组件:aspNetPOP3。它处理“困难”的事情(MIME 的东西)。对我来说效果很好。使用该库保存附件非常容易,例如:

POP3 pop = new POP3("127.0.0.1","[email protected]", "mypassword" );

pop.Connect();
MimeMessage msg = pop.GetMessage(1);

//save attachments to a directory
msg.SaveAttachments( "c:\\temp\\mydirectory\\", true );

pop.Disconnect();

In one of my projects I used a commercial server component: aspNetPOP3. It does of the "difficult" things (MIME stuff). Works very well for me. Saving an attachment is very easy using that library, for example:

POP3 pop = new POP3("127.0.0.1","[email protected]", "mypassword" );

pop.Connect();
MimeMessage msg = pop.GetMessage(1);

//save attachments to a directory
msg.SaveAttachments( "c:\\temp\\mydirectory\\", true );

pop.Disconnect();
难忘№最初的完美 2024-08-25 13:59:55

当您发送带有附件的电子邮件时,该文件会被编码为 base64 并包含在您的邮件中。因此,如果您已经收到电子邮件,那么您就已经收到了附件。现在只需对其进行解码即可。

如果您可以提供有关您目前进展情况的更多详细信息,我们将提供更多信息来帮助您解决此问题。

When you send an email with an attachment, that file is encoded as base64 and included into your message. So, if you already get your email message, you already got your attachment. Now it's just to decode it.

If you can provide more details on how far did you get, we'll can provide more information to help you to solve this issue.

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