First off, on your server you’ll need to enable the IIS role. To do so, click on the Server Manager on your task bar.
Select Roles in the menu on the left hand side, then click on Add Roles on the right.
Click the Next button to proceed. On the next screen labeled Select Server Roles select the Web Server (IIS) role, then click Next.
Click Next on the next screen to proceed. On the next screen labeled Add Roles Wizard scroll down to the Security section and select Basic Authentication. Clik Next.
Review your selection, then click the Install button to commit the changes and finish installing the Web Server (IIS) role on your server.
Once successfully completed click Close.
Back in the Server Manager click on Features on the left hand side menu, then click on Add Features on the right.
A new window labeled Add Features Wizard. Scroll down until you locate SMTP Server, then check the box to the left.
Once you do so, a new window will pop up prompting you to install additional services and features required to enable the SMTP Server role. Click on the Add Required Role Services to proceed.
You will be prompted three times to click the Next button to proceed. Lastly press the Install button.
Once the Role Services setup process has been completed successfully click the Close button.
Press the Start button in the lower left hand corner of the screen and type in services.msc in the search bar. Then run the Services snap-in.
Scroll down until you locate the Simple Mail Transfer Protocol (SMTP) service. Make sure that the service has been Started.
In you Start menu you should now have additional menu options available. Locate the Internet Information Services (IIS) 6.0 Manager link and click on it.
Right click on the SMTP Virtual Server #1, and select Properties from the menu.
A new window, labeled SMTP Virtual Server #1 Properties, will appear. On the General tab, click the Advanced button next to the IP Address drop down menu.
Click on the Add button.
In the Indetification window, select the appropriate IP address of the server you are using and specify port 25.
In the example above we are using the IP address 10.1.1.143 and port 25. Click OK to proceed.
Click on the Access tab, then press the Authentication button in the Access Contol section.
Make sure that the checkbox next to the Anonymous access is ticked.
Click OK.
Back on the Access tab, click on the Connection button in the Connection control section.
If you select the radio button next to Only the list below, you’ll need to use the Add button to specify IP address(es) and subnet masks (or IP address ranges) to specify individual endpoints or subnets that will be granted access to relay through using this SMTP server. In the example above endpoint at up address 10.1.1.100 will be allowed to relay.
Alternatively, you can opt to use All except the list below, in which case any endpoint originating from any IP address/subnet will be allowed to relay. Add button can be used to deny this privilege to specific IP address and/or IP address ranges.
Click OK once you are satisficed with your selections.
Back on the Access tab, lick on the Relay button in the Relay restrictions section, and repeat the same steps.
Click OK once done.
Next, click on the Delivery tab, then press the Outbound Security… button.
Make sure that the radio button next to Anonymous access is selected, then click OK.
Back on the [SMTP Virtual Server #1] Properties window, under the Delivery tab, click on Outbound Connections… Make sure that the TCP port value is set to 25.
Click OK.
Lastly, on the Delivery tab, click the Advanced… button.
Box labeled Fully-qualified domain name should contain the FQDN of the server you are using. Smart host field should contain the MX record you have defined for Exchange Online in your DNS infrastructure during the Office 365 Domain Setup process. This record is typically in the format of domain-com.mail.protection.outlook.com.
For example, Smart host record for the domain you are currently visiting (www.ponjavic.com) would be ponjavic-com.mail.protection.outlook.com.
You should however, validate what the appropriate Smart Host for your environment is. You can do so by navigating to https://portal.office.com and logging in using the credentials with the appropriate (administrator) level of access.
In the Office 365 Admin Center click on Domains on the left hand side. Select the radio button next to the appropriate domain, then click on Domain Settings on the right hand side.
Note the MX record points to address value. This is your Smart Host.
Next we’ll want to navigate to the Admin section in your Office 365 Admin Center, and click on Exchange.
You are now in the Exchange admin center section of the Office 365 portal. Select Mail Flow on the left hand side, then click on Connectors on the right. Press the + symbol to add a connector.
A new window labeled New Connector will pop up.
Use the drop down menu below From to select Your organization’s email server. Select Office 365 from the To drop down menu. Click Next to proceed.
Specify the Name and Description for the new connector.
On the next screen, select the radio button next to By verifying that the IP address of the sending server matches one of these IP addresses that belong to your organization. Press the + symbol to add one or more Public IP address(es) corresponding to the WAN circuit your SMTP relay server will be using. Once completed click on OK then Next then Save.
That completes the configuration process. To validate whether your local SMTP server can now successfully relay via Office 365, use the template below to create a .txt file.
FROM: email@domain.com
TO: email@domain.com
SUBJECT: Subject
Body of the email message.
Save the changes and copy the text file to your SMTP server. Take a copy of this file and paste it into C:\inetpub\mailroot\Pickup. Notice that your txt file will immediately disappear from this location and appear in C:\inetpub\mailroot\Queue as an entry with an .eml extension. Once the file is gone from the Queue folder, it has either been transmitted successfully or in case of an error, an entry will be created in C:\inetpub\mailroot\BadMail. Should this happen, open the appropriate .bad file using Notepad and review the error message.
Sample error message shows that an email was not sent because the Public IP address that was specified for the Connector was listed ina public Black List.