程序园

弹奏键盘人生,拂去青春的尘土,留下的只有岁月的痕迹
随笔 - 60, 文章 - 0, 评论 - 0, 阅读 - 27058
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

MIME_Entity[] attachments = mime.Attachments;
foreach (MIME_Entity entity in attachments)
{
string fileName = entity.ContentType.Param_Name;
string dir = Server.MapPath("~/d");
string path = Path.Combine(dir, fileName);
if (entity.Body is MIME_b_SinglepartBase)
{
MIME_b_SinglepartBase byteObj = (MIME_b_SinglepartBase)entity.Body;
Stream decodedDataStream = byteObj.GetDataStream();
using (FileStream fs = new FileStream(path, FileMode.Create))
{
LumiSoft.Net.Net_Utils.StreamCopy(decodedDataStream, fs, 4000);
}
}
if (entity.Body is MIME_b_MessageRfc822)
{
MIME_b_MessageRfc822 byteObj = (MIME_b_MessageRfc822)entity.Body;
Mail_Message mm = byteObj.Message;
mm.ToFile(path, null, null);
}
}

(评论功能已被禁用)
点击右上角即可分享
微信分享提示