SmtpClient deliveryMethod

http://bartwullems.blogspot.sg/2010/02/smtpclient-deliverymethod.html

SmtpClient deliveryMethod

One of the nice but little known possibilities of the System.Net.Mail.SmtpClient class is the ability to drop emails into a location on disk. This makes it very easy to test your code without the need of an SMTP server.

Update your app.config or web.config like this:

   1:  <system.net>
   2:    <mailSettings>
   3:      <smtp deliveryMethod="SpecifiedPickupDirectory">
   4:        <specifiedPickupDirectory pickupDirectoryLocation="c:\mails\"/>
   5:      smtp>
   6:    mailSettings>
   7:  system.net>


You can also configure this setting on the class itself. Files are dropped on the specified location and can be opened using Outlook Express or Windows Mail.


你可能感兴趣的:(.NET,Basic)