Mar*_*obr -3
以下代码取自我们的Rebex Mail组件附带的Extract Attachments 示例。如何从 POP3 服务器下载包含在 C# 博客文章中的 HOWTO:从 GMail 帐户下载电子邮件中。
// Load mail message from disk
MailMessage mail = new MailMessage ();
mail.Load (args[0]);
Console.WriteLine (
"Message contains {0} attachments.",
mail.Attachments.Count
);
// If message has no attachments, just exit
if (mail.Attachments.Count == 0)
return 0;
foreach (Attachment attachment in mail.Attachments)
{
// Save the file
Console.WriteLine ("Saving '{0}' ({1}).",
attachment.FileName, attachment.MediaType);
attachment.Save (attachment.FileName);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
20749 次 |
| 最近记录: |