简体   繁体   English

如何向asp.net中的dropfolder发送电子邮件?

[英]How do I send email to a dropfolder in asp.net?

I have two questions: 1) How do I send an email in C#, but have it end up in a drop folder to be sent from there rather than being sent straight out by SMTP? 我有两个问题:1)如何在C#中发送电子邮件,但最终是在一个drop文件夹中从那里发送而不是直接通过SMTP发送?

2) For a production machine, do I use IIS to process the dropfolder, or should I purchase a 3rd party product for this? 2)对于生产机器,我是否使用IIS来处理dropfolder,或者我应该为此购买第三方产品?

Thanks! 谢谢!

In your web.config: 在你的web.config中:

<system.net>
  <mailSettings>
     <smtp deliveryMethod="SpecifiedPickupDirectory">
      <specifiedPickupDirectory pickupDirectoryLocation="C:\myDropFolder" />
     </smtp>
  </mailSettings>
</system.net>

Whether to use IIS or some third party product... I guess that depends on your needs. 是否使用IIS或某些第三方产品......我想这取决于您的需求。 Is there a particular feature you would like and that the IIS SMTP server does not have? 是否有您想要的特定功能以及IIS SMTP服务器没有?

You can also set this in code on the DeliveryMethod property of the SmtpClient object. 您还可以在SmtpClient对象的DeliveryMethod属性的代码中设置它。

SmtpClient client = new SmtpClient();
client.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory;
client.PickupDirectoryLocation = "C:\DropFolder";

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM