From time to time you may need an SMTP service to relay mail from an internal application. I generally create these services for applications which only need to send mail from an internal network segment. A good example would be Scan to Email multi-function devices on a local network.

With the recent release of Windows Server 2016 I decided to investigate if this service was still present and if so, had there been any changes made to it in this latest release of Windows Server. I can confirm that the service has not changed at all and is in fact still the same SMTP service I first used back when Windows Server 2003 was launched. In fact, Windows Server 2016 still uses IIS 6 tools to host and manage the SMTP service. This is truly remarkable that a fundamental service like SMTP has not been changed for at least the last 13 years. The old adage of, ‘If it isn’t broken, do not fix it’ comes to mind.

For a completeness I installed the service and tested it and you can follow the steps I took in the example I have illustrated using a step-by-step visual guide.

First we need to add the SMTP Feature using Server Manager. Open Server Manager, click on ‘Manage’ and then in the menu that is presented click on ‘Add Roles and Features’.

On the ‘Before you Begin’ page, review you have the necessary rights etc. and then click on ‘Next’.

Ensure ‘Role-based or feature-based installation’ is selected and then click ‘Next’.

Select your destination server to install this feature on. It should default to the localhost. Click ‘Next’.

On the ‘Select server roles’ page do not select anything and Click ‘Next’.

On the ‘Select features’ page scroll down and then select ‘SMTP Server’.

An ‘Add Roles and Features’ Wizard will pop-up. Click on ‘Add Features’.

You will be returned to the ‘Select features’ page and the SMTP Server checkbox should now be ticked. Click ‘Next’.

The SMTP Server runs on IIS so you will now be presented with the ‘Web Server Role (IIS)’ page. Click ‘Next’.

On the IIS ‘Select role services’ page. Leave the default selection as is and then click ‘Next’.

You are finally presented with the ‘Confirm installation selection page’. Check that all the settings you selected in the previous steps are listed and then click on ‘Install’.

If the installation has succeeded, you should be presented with a successful installation message as shown in the diagram below.

Now that we have the SMTP Server installed, the first thing we need to do is go and set the service to start automatically. By default this service is set to start manually so the next time the server restart this service will not be available. To set the service to automatic follow these few steps.
Open services.msc and find the SMTP Service in the list.

Open the service properties and set the ‘Startup Type’ to ‘Automatic’ and then click ‘Apply’ and ‘Ok’

Now let us go and configure the actual SMTP Server. First open IIS 6 Manager

Your IIS 6 Manager should look like the image below once you have expanded all the nested items.

Right-Click on the ‘SMTP Virtual Server’ Node and select ‘Properties’

Select the ‘Access’ Tab at the top of the Window and then click on ‘Connection’

Choose the ‘Only the list below’ radio button as this secures your server by only allowing SMTP connections from known IP Addresses.

You can add s single computer, a group of computers or an entire domain as shown in the image below. I am only configuring a single server in this example.

Once you have entered your server / service IP addresses and click ‘OK’ your Connection dialog box should look like the image below. Click ‘Ok’ to go back to the main Access tab of the server configuration window.

Now we will repeat the same process for ‘Relay’. We have configured the server to accept connections from certain IP addresses. Now we must allow those IP addresses to relay SMTP traffic through this SMTP server. Click on ‘Relay’

Ensure that the ‘Only the list below’ radio button is selected. As with ‘Access’ this secures your server by only allowing SMTP relaying from known IP Addresses.

As with ‘Access’, you can add s single computer, a group of computers or an entire domain as shown in the image below. I am only configuring a single server in this example.

Once you have entered your server / service IP addresses and click ‘OK’ your Connection dialog box should look like the image below. Click ‘Ok’ to go back to the main Access tab of the server configuration window.

Once you are back on the main SMTP Server configuration window. Click on ‘Apply’ to save your configuration changes and then click ‘Ok’ to exit the dialog box.

Now that the server has been configured to accept and relay SMTP connections from known IP addresses we now need to configure the mail domains that can use this service.
In your IIS 6 Manager right-click on ‘Domains’ and then hover over ‘New’ until ‘Domain…’ is shown. Click on ‘Domain…’

Select the ‘Remote’ radio button and click ‘Next’.

Type in the mail domain you want to use and then click on ‘Finish’.

You should now see your domain in the ‘Domains’ window as per the screen clipping below.

Your SMTP Server is now configured and ready to go. For good measure restart the SMTP service to ensure all configurations are set and ready.
sc stop smptsvc
sc start smtpsvc


If you want to test your SMTP server via the command line follow the following steps.
First telnet to your server on port 25. Remember that you must telnet from an IP that has been granted both access and relay rights.

Now type the following.
helo me <Enter>
mail from: (email address you are sending from) <Enter>
rcpt to: (email address you are sending to) <Enter>
data<Enter>
Subject:test mail at (time)<Enter>
<Enter>
Type something here which will be in the mail body<Enter>
.<Enter> <= That is a full stop and hit Enter to send your email.

Note that this service is very temperamental and does not allow mistakes i.e. if you make an error backspace and delete are not recorded so rather retype the command after hitting enter and getting an error.
If you have not received an email as part of your test go and check the queue which can be found at C:\intepub\mailroot\Queue.

I have often found the issue to be misconfigured DNS on the SMTP server.

13 Comments

  1. Vincent

    Thanks your detailed post! Could you please also share how to backup/restore IIS SMTP Server in Windows Server 2016?

  2. Chris Lazari

    Hi Vincent. Thank you for the feedback. I will move that to the top of the list and will get that posted ASAP.

  3. Vincent

    Hi Chris,

    Thanks your reply! I would revise the question: “Could you please also share how to backup/restore IIS SMTP Server in another Windows Server 2016?”

    I tried to follow below link to backup config but fail to restore to another same version server(windows and IIS).

    Ref: http://tritoneco.com/2015/09/02/backup-and-restore-iis-to-another-server/

  4. Chris Lazari

    Hi Vincent,

    I have published a post on backing up and restoring IIS on Windows Server 2016 which you can read here: http://chrislazari.com/backup-and-restore-iis-on-windows-server-2016/

    The process is exactly the same as in previous versions of IIS. I have tested the process and it works for all web applications as long as you keep the dependencies in mind which are listed in my post.

    The SMTP service cannot be backed up in the same way. The only way to migrate SMTP is to reconfigure it from scratch.

    I hope this helps in some way.

  5. Erdal Güral

    Hi Chris,
    Thank you so much for informations. You help us too much.

    Kodpen Web Design

  6. John Patterson

    Sorry for replying to an old post, but is there a way to force IIS SMTP to send all email received to a single email address? Our developers are not wanting to change their code for testing with the exception of the SMTP server, so I need to get creative and figure out if there is a way to send everything hitting that SMTP server to a scratch mailbox regardless of where it is actually trying to send to.

  7. kawakuchi

    Hi Chris

    I want to provide my tutorial about DNS MX settings for SMTP server.
    DNS MX/SPF settings for SMTP server
    hope it helps people.

  8. Chris Lazari

    Unfortunately I cannot think of any specific setting on the SMTP service where this is configured.

    Apologies

  9. Chris Lazari

    Thank you for the link. I have added it.

  10. Le rois

    How do you add or import a SSL widl card cert? One of my web apps requires TLS connection.

    Thanks,
    Le

  11. James

    Hello,

    I am working in one of the Construction company. Our Main Exchange server is located in Dubai and we are working in Kuwait .
    Can I create local email server in Kuwait office and then sync that local to exchange server which is located in Dubai ?

  12. Humberto Oliveira

    Hello Chris Lazari, I’m from Brazil, sorry to ask in this old post, I have a service for this SMTP installed, some users complain that they are receiving notification email from the relay as below. Is there a way to configure something regarding this relay sending so that users do not receive this notification?

    De:
    Date: ter., 18 de ago. de 2020 às 13:34
    Subject: Delivery Status Notification (Relay)
    To:

    This is an automatically generated Delivery Status Notification.

    Your message has been successfully relayed to the following recipients, but the requested delivery status notifications may not be generated by the destination.

  13. hywel

    Welcome everyone ! I’m Hywel.
    Even though I jokingly credit my aunt for my writing talent, I know that it is a talent I have fostered from childhood. Though my grandmother is a writer, I also started out young.
    I’ve always had a way with words, according to my favorite professor . I was always so excited in English when we had to do a research writing assignment.
    Now, I help current students achieve the grades that have always come easily to me. It is my way of giving back to communities because I understand the obstacles they must overcome to graduate.

    Hywel – Academic Writing Professional – http://www.partapcollege.com Company

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.