Setting up a SMTP Server on an Azure Virtual MachineAuthor: John Doyle
12/01/2017 UPDATE: It is Against the Azure Terms of Service to use a VM to send out emails. Microsoft recommends you use a third party email sender.
Today I had an interesting challenge. It was to set up a SMTP server on an Azure virtual machine for a client who were moving to the cloud.
As we all know Microsoft likes to lock down or change certain settings on us when using their cloud services so hopefully this guide will help someone when setting up their SMTP on an Azure VM.
Here is the steps I needed to do in order to get SMTP server working on the Azure virtual machine.
- Install SMTP via Server Manager > Manage > Add Roles and Features
- Click Next until you reach “Server Roles”
- Tick Web server
- Click Next
- Tick SMTP
- After Installation Open IIS 6.0 Manager
- Right Click on SMTP Virtual Server and click properties
- Pick the VMs local IP address (Should be only one in drop down)
- Click Access Tab
- In the “Connection” and “Relay” screens select “All Except the list below”
- Click Apply and OK
- Go to Services
- Right Click “Simple Mail Transfer Protocol”
- Set the startup type to Automatic
- Click Apply
- Stop and Start the Service
- Click OK
- In your Web configs ensure to change any SMTP Server values from “localhost” to the name of the Azure VM e.g. “DovetailExampleVMName” This is the name you used when you first created the Virtual Machine on the Azure portal.
- Test your SMTP server
Hope this helps some people who are having trouble porting some websites over to an Azure virtual machine that used SMTP on their server.