开发者

ASP.NET: How to download email attachments with POP3?

I am bu开发者_开发技巧ilding 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!


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","dave@blah.com", "mypassword" );

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

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

pop.Disconnect();


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜