将带有附件的电子邮件附加到另一封电子邮件
所以我知道如何发送带有附件的电子邮件......这很简单。
现在的问题是我需要将一个具有自己的附件的 MailMessage 添加到另一个 MailMessage 中。这将允许用户查看内容并获取预先制作的电子邮件,如果一切正常则发送。
我不确定这是否是最终的工作流程,但我想知道是否容易。
我看到有很多软件是为了赚钱,收到这些电子邮件的用户将使用 Outlook 客户端。
这将部署到一个廉价的共享托管解决方案,必须能够在 Meduim Trust 中运行!
我宁愿不必许可第 3 方软件,没有 $ :(
任何想法都会很棒。
So I know how to send emails with attachments... thats easy.
The problem now is I need to add an MailMessage, that has an attachment of its own, to a different MailMessage. This will allow the user to review things and take the email that is pre-made and send it if everything is ok.
I am not sure this will be the final work flow, but I would like to know if easy.
I see a bunch of software out there that is for money, the users getting these emails will be using an outlook client.
This would be deployed to a cheap shared hosting solutions, must be able to run in Meduim Trust!
I would prefer not to have to lic a 3rd party software, No $ :(
Any ideas would be awesome.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
MailMessages 不能附加到其他MailMessages。您要做的就是创建一个 .msg 文件,该文件基本上是一个存储电子邮件及其所有附件的文件,并将其附加到您实际的 MailMessage 中。 Outlook 支持 MSG 文件。
有关文件扩展名的更多信息,请转到此处:http://www.fileformat.info/format/outlookmsg /
MailMessages cannot be attached to other MailMessages. What you will do is create an .msg file, which is basically a file that stores an e-mail and all of its attachments, and attach that to your actual MailMessage. MSG files are supported by Outlook.
For more information about the file extension, go here: http://www.fileformat.info/format/outlookmsg/
正如 Justin 所说,API 中没有将一个 MailMessage 附加到另一个 MailMessage 的工具。我使用 SmtpClient 将内部消息“传递”到目录,然后将生成的文件附加到外部消息,从而解决了这个问题。这个解决方案并不是很有吸引力,因为它必须利用文件系统,但它确实完成了工作。如果 SmtpDeliveryMethod 有 Stream 选项,那就干净多了。
需要注意的一件事是,SmtpClient 在创建邮件文件时为 SMTP 信封信息添加 X-Sender/X-Receiver 标头。如果这是一个问题,您必须在附加邮件文件之前将它们从邮件文件的顶部删除。
As Justin said, there is no facility to attach one MailMessage to another in the API. I worked around this using the SmtpClient to "deliver" my inner message to a directory, and then attached the resulting file to my outer message. This solution isn't terribly appealing, as it has to make use of the file system, but it does get the job done. It would be much cleaner if SmtpDeliveryMethod had a Stream option.
One thing to note, the SmtpClient adds X-Sender/X-Receiver headers for the SMTP envelope information when creating the message file. If this is an issue, you will have to strip them off the top of the message file before attaching it.