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
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
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.
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.
All you need to do is point your application you use localhost as the SMTP server (like the Local or other SMTP Server setup)