发送保存在磁盘上EML文件 [英] Send eml files saved on disk

查看:224
本文介绍了发送保存在磁盘上EML文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创造EML的使用过程中提到过的此处
我想知道如何发送这些EML文件?
我试着用SMTPClient类的对象,但它需要MAILMESSAGE对象作为参数,我找不到和方法来建立使用这些保存的EML文件类型MAILMESSAGE的对象。

I am creating eml's and saving them to a directory using procedure mentioned over here. I want to know how to send these eml files? I tried using SMTPClient class's object but it takes MailMessage object as its parameter and I couldn't find and way to create an object of type MailMessage using these saved eml files.

推荐答案

正确加载一个EML文件并不像看起来那么容易。你可以写几天之内95%的情况下工作的实现。剩下的5%将需要至少几个月;-)。我知道,becase的我参​​与开发有一个

Loading an EML file correctly is not as easy as it looks. You can write an implementation working in 95% cases within few days. Remaining 5% would take at least several months ;-). I know, becase I involved in developing one.

考虑以下dificulities:

Consider following dificulities:


  • unicode的电子邮件

  • 从右到左的语言

  • 纠正流行的邮件客户端和服务器造成众所周知的错误畸形的EML文件

  • 处理S / MIME(加密和签名的电子邮件)

  • 用编码附件

  • 的几种方法正确处理处理与内嵌图像和样式表嵌入到HTML电子邮件

  • 确保其正确解析一个的从迈克·克里斯平MIME折磨消息

  • 确保畸形消息不会导致缓冲区OVERUN或其他应用程序崩溃
  • 处理嵌套的消息(消​​息附带消息)

  • 确保它可以正确处理非常大的邮件

  • unicode emails
  • right-to-left languages
  • correcting malformed EML files caused by well known errors in popular mail clients and servers
  • dealing with S/MIME (encrypted and signed email messages)
  • dealing correctly with several methods of encoding attachments
  • dealing with inline images and stylesheets embedded into HTML emails
  • making sure that it parses correctly a MIME torture message from Mike Crispin (coauthor of Mime and IMAP RFCs)
  • making sure that malformed message will not result in buffer overun or other application crash
  • handling hierarchical messages (message with attached messages)
  • making sure that it handles correctly very big emails

这样的解析器成熟需要几年,不断反馈,它的用户。现在的问题是包含在.NET Framework中没有这样的解析器。直到它改变了我会sugest从建立供应商得到一个THRID党MIME解析器。

Maturing of such parser takes years and continuous feedback for it's users. Right now is no such parser included in the .NET Framework. Until it changes I would sugest getting a thrid party MIME parser from an established vendor.

下面的代码使用我们的 Rebex的安全邮件组件 ,但我敢肯定,类似的任务可以很容易地与其他供应商以及零部件复制

Following code uses our Rebex Secure Mail component, but I'm sure that similar task could be replicated easily with components from other vendors as well.

中的代码是基于的Mail消息教程

// create an instance of MailMessage 
MailMessage message = new MailMessage();

// load the message from a local disk file 
message.Load("c:\\message.eml");

// send message
Smtp.Send(message, "smtp.example.org");

这篇关于发送保存在磁盘上EML文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆