How to Test a .NET Application That Uses SMTP

November 27, 2007

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.

    <smtp from="****" deliveryMethod="SpecifiedPickupDirectory">  
      <specifiedPickupDirectory pickupDirectoryLocation="**c:MailFolder**"/>  

Profile picture

Written by Edin Kapić Insatiably curious code-writing tinkerer. Geek father. Aviation enthusiast. Cuisine journeyman. Follow me on Twitter