发送内联 MHTML
我想知道是否可以通过.NET 2.0 MailMessage 对象 用于发送即时创建的内联 MHTML 文件。
内联我的意思是:它应该以用户打开电子邮件后可以看到的方式发送,而无需打开/下载附件。
I was wondering if it is possible through the .NET 2.0 MailMessage object to send an inline MHTML file that is created on the fly.
By inline I mean: It should be sent in a way that the user can see it, once he opens the email, without having to open/download the attachment.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
这有点棘手,但是是的,你可以做到。 事实上,MailMessage 类只不过是系统 CDO.Message 类之上的一个包装器,它可以做到这一点。
您也可以使用 AlternateView 功能,它更简单:
It's a bit tricky, but yes, you can do it. In fact MailMessage class is nothing more than a wrapper above the system's CDO.Message class which can do the trick.
Also you can use AlternateView functionality, it's more simple:
(jdecuyper——感谢您的插件,因为我写了 aspNetEmail)。
您可以使用 aspNetEmail 来完成此操作。 您可以使用 MHT 替换电子邮件的全部内容。
您无法使用 System.Net.Mail 执行此操作,但如果您想走商业路线,请向我发送一封电子邮件,地址为 [电子邮件受保护],我将向您展示如何完成此操作。
如果您想走开源路线,您可以修改 codeproject 上的一些 SMTP 代码来实现此目的。 基本上,您可以将内容注入 SMTP 进程的 DATA 命令中。
需要注意的一件事是:如果您的 MHT 文档嵌入了脚本、flash、activeX 对象或任何可能被邮件客户端阻止的内容,则它的呈现方式可能与您在浏览器中看到的内容不同。
(jdecuyper -- thanks for the plug, as I wrote aspNetEmail).
You can do this with aspNetEmail. You can replace the entire contents of the email message with your MHT.
You can't do this with System.Net.Mail, but if you want to go the commerical route, pop me an email at [email protected] and I'll show you how this can be done.
If you want to go an open source route, there is probably some SMTP code on codeproject that you could modify to do this. Basically, you would inject your contents into the DATA command of the SMTP process.
One thing to note: If your MHT document has embedded scripts, flash, activeX objects or anything that may be blocked by the mail client, it probably won't render the same as what you are seeing in the browser.
您是否想在 html 电子邮件中添加一些图像?
为此,您需要将图像嵌入到电子邮件中。 我找到了一个教程来用几行代码完成它。 您还可以购买 aspnetemail 程序集。 发送带有嵌入图像的电子邮件总是对我有很大帮助,如果出现任何问题,他们也有一个优秀的支持团队。
请记住,嵌入图像会使您的电子邮件变得更重,但更好:)
Are you trying to add some images to an html email?
To accomplish this you will need to embed the images inside your email. I found a tutorial to accomplish it in a few lines of code. You can also buy the aspnetemail assembly. It has always helped me a lot to send emails with embedded images, they also have an excellent support team if anything goes wrong.
Keep in mind that embedding images makes your email heavier, but nicer :)
可以通过 CDO.Message (需要添加到项目引用 COM 库“Microsoft CDO for Windows 2000 Library”):
It is possible via CDO.Message (it is necessary add to project references COM library "Microsoft CDO for Windows 2000 Library"):
可以通过 CDO.Message (需要添加到项目引用 COM 库“Microsoft CDO for Windows 2000 Library”):
It is possible via CDO.Message (it is necessary add to project references COM library "Microsoft CDO for Windows 2000 Library"):