Implementing public web site, we usually need an SMTP server for registration verification, reset password notification, etc. We usually utilize existing email infrastructure to send the email. However, we may not have the control of the infrastructure. The SMTP server may locate overseas or may go down sometime. In these cases, the response of the web server seems slow. We can setup the SMTP in local server to resolve the problem.
How does SMTP works?
There is a special record in DNS called MX record (Mail eXchange record). Using firstname.lastname@example.org as an example. The SMTP server inquires the MX record of b.com to resolve the SMTP server that will receive the email.
SMTP Setup in Windows
Windows comes with SMTP service in XP, 2003, Vista, and 2008. It can be configured with the following steps
1. In IIS Manage, right click Default SMTP Virtual Server, choose Properties
2. Choose Access tab and click the Relay button at the bottom in Relay restriction section. An SMTP relay lets an SMTP client use an SMTP server to forward e-mail messages to a remote domain. By default, it is disabled so you cannot send any email.
3. Add your local host address to allow your local application to send email. You can even add your internal network address so your other machine can use this as the SMTP relay.
4. Optionally, you can prohibit the external connection by configuring the Connection control section.
Since SMTP will queue the email and return, it responses instantly. The web performance also improves instantly, too.