The topic of SMTP servers is far from glamorous. In fact, it could probably put an insomniac to sleep. Most people simply put SMTP in a black box and expect it to work. If you have your own cloud or physical server, though, this can lead to problems because most servers aren’t initially configured to send email.
Chances are that if you have a Windows cloud server, you’ll want to send email from it. Fortunately, Microsoft includes a free SMTP server. Unfortunately (at least for most people), it’s not installed by default!
The good news is that installing a SMTP server is a simple process. Here’s how.
Installing Microsoft SMTP Server
Open Server Manager and select Manage -> Add Roles and Features in the upper right menu. This will start the Add Roles and Features Wizard.
Keep clicking Next until you get to the Select Features page.
Scroll down and check the box for SMTP Server. This will open a new window informing you that other features are needed. Make sure the box is checked to Include management tools and click Add Features. Continue through the wizard and click Install at the end. Wait for SMTP server to be installed then click Close.
Configuring Microsoft SMTP Server
Next we want to configure the SMTP server. Open up Internet Information Services (IIS) 6.0 Manager and drill down to SMTP Virtual Server. Right-click it and choose Properties. The one property you’ll definitely want to change on the General tab is to check the box to enable logging. If you don’t enable logging there won’t be any logs to check if you need to troubleshoot something after the fact.
Leave the IP address as (All Unassigned).
NOTE: One limitation I have found using Microsoft SMTP server is that it will send the email from the server using whatever IP address it wants to. If you have more than 1 IP address you may want to consider installing a different mail program to use as a SMTP server.
Click the Properties… button in the logging area and then click on the Advanced tab. You will see that even though you enabled logging there is nothing selected. Just checking the box to enable logging will still not provide anything helpful. Go ahead and check all the boxes. When someone doesn’t receive an email and you need to troubleshoot, you want all the logs you can have at your disposal. Click OK once you have checked all the boxes.
Move over to the Access tab and click the Relay… button. You can see that nobody is allowed to relay through this computer by default. Click Add and enter 127.0.0.1 for localhost under single computer. After clicking OK your Relay Restrictions should look like this. Click OK to get back to the SMTP Virtual Server Properties and OK once again to exit back to Windows. Your basic configuration of Microsoft SMTP server is now complete.
The DNS side of sending email
If we stop here, though, you are still likely to have problems with email sent from this server. There is a good chance that some of the email to your recipients is going to end up in their junk mail or spam folder. Why is that, you ask? That is because many mail servers do a reverse lookup during the initial handshake.
What is a reverse lookup? As you may know, DNS helps make the Internet human friendly. Without DNS, we would have to remember to go to 220.127.116.11 instead of going to google.com, for example. So DNS maps a domain name to an IP address. Conversely, a reverse DNS maps an IP address to a domain name. Mail servers use this as a step to help combat spam. If you are setting up a mail server (which includes a simple SMTP server like this), you will need a reverse DNS PTR record. If you manage your DNS servers, you can add this. If your DNS is managed somewhere else, contact their support department to help you get a PTR record setup.
What about POP3?
Many Internet users are confused by the configuration of their client mail programs and think that mail is sent on SMTP port 25 and received on POP3 port 110 when mail is actually sent and received by mail servers across the Internet using SMTP on port 25. POP3 has nothing to do with mail flow other than it is the protocol (Post Office Protocol – POP) used by mail clients to connect to their Post Office – i.e. mail server. POP3 serves no other purpose for mail routing.
We have no POP3 settings to configure because the SMTP server is used for sending mail from your applications to mail servers on the Internet. This article is not intended to be used to setup an actual client mail server that receives email.
No setup is complete without a test. The best method I’ve found to quickly test an email setup is to telnet into the mail server and try sending an email. Here are those steps for your reference.
- Open a Command Prompt on the server.
- Connect to the server using Telnet by typing telnet localhost 25 and pressing enter.
- Type helo
- Type mail from:email@example.com using your actual email address
- Type rcpt to:firstname.lastname@example.org using a test email address
- Type data
- Type something that will serve as the body of the email then enter a period ‘.’ on a line by itself to send the email
- You should receive the email at the test email address confirming that everything is setup properly.
With most programs or features that you install, the services are not always configured the way you may want them to be, so you should always verify those settings. Open up the Services MMC and scroll down to Simple Mail Transfer Protocol (SMTP).
Double-click it to open the STMP Service properties. The first thing you will probably notice is that the service is set to manual. Chances are that you’ll want the startup to be Automatic.
Lastly, click on the Recovery tab. You will see that service failures are set to take no action by default. However, if the server crashes, you will want it to try and restart the service, so set all three drop-down boxes to Restart the Service.
You should now have the Microsoft SMTP Server installed, configured, and tested on your server.