Connect with me
Search
Twitter Feed
Navigation
« VSTO - Error when adding items to ComboBox | Main | Configuring IIS 6.0 for Silverlight »
Thursday
Nov182010

Tip – Test sending emails from your application without an SMTP Server

Frequently the applications that we develop will need to send out an email (e.g. for account registration, order confirmation or newsletter). How does a developer tests that the emails are formatted and mail merged correctly? The options you have are:

  • Local or other SMTP server (not applicable for Windows 7 as there is no local SMTP server option anymore)
  • Local Directory Delivery
  • Smtp4Dev (recommended)

Local or other SMTP Server

Edit your web.config/app.config to use your local or remote SMTP server. For Windows 7 users, you no longer have the option to install an SMTP server (a good thing), so I suggest either using another host or using Smtp4Dev (see below).

Make the following change to your web.config or SMTP Email Settings in IIS 7


    
        
            
        
    

image

Local Directory Delivery

This option allows mail to be saved to a local directory that you can then open (or redeliver with another application). To configure this you can modify the web.config as follows:


    
        
            
        
    

Or set this up in SMTP Email Settings in IIS

image

So when the application sends an email, it will be saved into the pickup directory. You can then double click to open the email in your email client.

SNAGHTML189323

Smtp4Dev

Smtp4Dev is a good compromise between the two solutions. It installs a fake SMTP server on your local computer that listens for emails. It then presents a UI for all the emails you receive and you can double click to open the email.

SNAGHTML3f08f6

 

All you need to do is point your application you use localhost as the SMTP server (like the Local or other SMTP Server setup)

Reader Comments (1)

Zune and I used papercut (http://papercut.codeplex.com) it's similar concept for SMTP4DEV.
We used this to test our newsletter mail out during CRM rollup testing (about 1k emails), with good results.

Files are dumped in a folder as .eml and you can open it in Outlook to check it's "sent" properly.

07 January 2011 | Unregistered CommenterJohn Liu

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>