How to Test a .NET Application That Uses SMTP

How many times you had to set up a SMTP service just to test that your .NET application sends the e-mail correctly? I found that I can test the actual application (not the SMTP delivery) by using a bogus SMTP server in the config file.

It pretends to be a SMTP server but it "delivers" the messages by leaving them into a folder you specify.

<system.net>
  <mailSettings>
    <smtp from="admin@domain.com" deliveryMethod="SpecifiedPickupDirectory">
      <specifiedPickupDirectory pickupDirectoryLocation="c:MailFolder"/>
    </smtp>
  </mailSettings>
</system.net>

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.