Home » General » Windows SMTP Server relay through Gmail

Windows SMTP Server relay through Gmail

This tutorial with show how Windows SMTP Server relay mails through Gmail or any other mail server. This is useful if your server is located on a network with dynamic IP address.

I had this issue when a monitoring software needed to send notification mails but there was no option of authenticating to the SMTP server. I installed Windows SMTP server but all my mails ware blocked by the SPAM filters. The solution was to relay all mails through a mail server.

If you are sending small number of mail this is good solution, but if your system sends a lots of mails you can be blocked by Gmail’s limits. In this case use your own mail server.

Install Windows SMTP Server

Open the Windows Server 2008 Server Manager and under Features, select Add Features

Windows 2008 Add Features

You need to check box next to SMTP Server and click Next

Windows 2008 Select SMTP feature

If you don’t have IIS 6 Management Console installed Windows 2008 will install the missing Roles for the SMTP Server to work, just click the Add Required Role Services button, and click Next on the previous screen.

Windows 2008 add required services

As you can see now it will install the IIS 6 Management Compatibility, IIS 6 Management Console and the SMTP Server. Press Install as shown on the screen.

Windows 2008 Install SMTP

Now the installation will begin and it will can take several minutes for this process to finish.

Windows 2008 SMTP installing progres
As you can see the Installation succeeded on the screen the installation of the Windows SMTP Server is complete. Press Close and we can start the configuration.

Windows 2008 SMTP installing complete

Configure Windows SMTP Server relay

Open Internet Information Services (IIS) 6.0 Manager, right click SMTP Virtual server, select Properties, select the Access tab and click Relay

SMTP Access Tab

You can add here list of servers that will send mails trough this server. Click on Add to add all the servers you need, and click OK

SMTP Relay Restrictions

Select the Delivery tab and click Outbound Security…

SMTP Delivery Tab

Select Basic Authentication, enter your Gmail account (i.e. youracccount@gmail.com), enter your Gmail password, check TLS encryption and press OK

SMTP Outbound Security

Select the Delivery tab and click Outbound connections…

SMTP Delivery Tab

Set TCP port to 587 and click OK

SMTP Outbound Connections

Select the Delivery tab and click Advanced…

SMTP Delivery Tab
Enter the Full-quailified domain name – this should be what you want this SMTP server to be called. If your server name is SMTP and your domain is YOURDOMAIN.COM then the entry should be smtp.yourdomain.com
Enter smtp.gmail.com as the Smart host and click OK

SMTP Advanced Delivery

Now you can configure your servers to use smtp.yourdomain.com as SMTP server and it will relay the mails trough your Gmail account.

One final note: Don’t forget to set the Simple Mail Transfer Protocol (SMTP) service to start automatically. Start your Services console, right click Simple Mail Transfer Protocol (SMTP), select Properties and change Startup type: Automatic

SMTP Services Automatic

You need to have Gmail Account or create one at: http://www.gmail.com
Enable the Gmail account for POP3 in Gmail, you can follow the instructions on how to do this here: http://mail.google.com/support/bin/answer.py?answer=13273&cbid=wl8yzeug2lob&src=cb&lev=topic

About Nikola Stojanoski

System Administrator and Developer. Giving back to the community by blogging about my problems, solutions and practical howto's.