lumisoft会将eml后缀格式的附件给解析成文本,这里保存成文件
2017-02-16 15:35
417 查看
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);
}
}
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);
}
}
相关文章推荐
- CxImage与OpenGL结合,用于读入多种格式的纹理以及用来把屏幕保存为各种格式的图像文件。 关于CxImage的文章,网上有许多,这里只介绍如何把CxImage与OpenGL结合起来,用于读
- VB打开/保存任意编码格式文本文件
- 读取eml格式文件,并解析
- 根据标题后缀名传参点击下载保存内容为任意格式文件(内容为oracle库中某字段值:BLOB类型)
- PHP 解析Maildir 邮件格式(eml文件)
- C# 查找指定目录下指定文件名或格式的文件并将结果保存到文本
- 记事本里出现该文件含有Unicode格式的字符,当保存为ANSI编码的文本时,该字符将丢失,解决方法
- 文件关联修复工具(用文本文档保存后后缀修改为bat)
- excel保存转换文本格式的宏
- 解析Java的Class文件格式——解析魔数和版本号
- (原创)bls文件格式的解析
- bmp文件MFC中翻转、保存和解析代码
- C#中如何保存文本为Word文件或Excel文件
- 把文件以二进制格式或base64字符串形式保存到数据库中,并实现下载功能源码
- vc生成的各种文件格式解析
- CxImage与OpenGL结合,用于读入多种格式的纹理以及用来把屏幕保存为各种格式的图像文件。
- 使用hta保存utf8格式的文件的代码
- RichTextBox文本保存为WORD格式
- 关于.JS文件保存编码格式的问题-兼容各种语言版本
- 写UNICODE格式的文本日志文件(UNICODE编码)