使用SmtpClient我怎样才能节省发送电子邮件呢? [英] How can I save an email instead of sending when using SmtpClient?
问题描述
我使用SmtpClient用附件发送的电子邮件。 然而,对于某一批,我们需要以某种方式保存发送它们的MailMessage代替。 我们再思考/希望手动上传信息到用户的草稿文件夹。
I am using SmtpClient to send an email with an attachment. However for a certain batch we need to somehow save the MailMessage instead of sending them. We are then thinking/hoping to manually upload the messages to the users drafts folder.
是否可以保存附件完好(是不可能的,我还以为)这些消息。或者可以选择的信息上传到用户帐户的文件夹?
Is it possible to save these messages with the attachment intact (impossible, I would have thought). Or alternatively upload the messages to a folder in the users account?
如果任何人有这样的经验,我更AP preciate一点帮助或指针。
If anyone has any experience of this, I'd much appreciate a bit of help or a pointer.
推荐答案
在ASP.NET中,我们的测试我们的邮件保存到一个文件夹,而不是通过电子邮件服务器发送。也许你可以改变你的的web.config
设置,这样你批?
When testing in ASP.NET we save our emails to a folder rather then send them through an email server. Maybe you could change yourweb.config
settings like this for your batch?
<system.net>
<mailSettings>
<smtp deliveryMethod="SpecifiedPickupDirectory">
<specifiedPickupDirectory pickupDirectoryLocation="c:\Temp\mail\"/>
</smtp>
</mailSettings>
</system.net>
其他信息:
- MSDN: <specifiedPickupDirectory> Element (Network Settings)
- Configuring SmtpClient to drop emails in a folder on disk
这篇关于使用SmtpClient我怎样才能节省发送电子邮件呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!