How can I save an email instead of sending when using SmtpClient?

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>

Additional Info:

  • MSDN: <specifiedPickupDirectory> Element (Network Settings)
  • Configuring SmtpClient to drop emails in a folder on disk

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)