我正在创建 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% 至少需要几个月的时间;-).我知道,因为我参与了开发.
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.
考虑以下困难:
这种解析器的成熟需要数年时间,并需要持续不断地为其用户提供反馈.目前 .NET Framework 中还没有这样的解析器.在它改变之前,我建议从一个成熟的供应商那里获得一个第三方 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 Secure Mail 组件,但我确信其他供应商的组件也可以轻松复制类似的任务.
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.
代码基于邮件消息教程.
// 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 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!