In my ongoing mission to go “off-igrid” I needed to find a way to use my home server to run my own SMTP server (rather than relay on third parties for this). WordPress will also use this as its mail client to send out newsletters etc. It was easier than I thought..
It was somewhat confusing, because a lot of guides spoke about Windows Server acting as a “relay” to other SMTP servers. I assumed that this meant that I couldn’t server emails withoput another provider. However, this isn’t the case. See below on how to get up and running.
Add SMTP to Server Roles and Features
Go to Server Manager>Add Roles and Features and install SMTP Server
Access your SMTP Server’s Properties
You need to open IIS 6 Manager – do this through Server Manager>Tools>(IIS) 6.0 Manager. Then right click on your Server and select Properties
Under General, set your IP address to match that on your local area network. You can do this via Command Prompt and IpConfig:
It should look something like this:
Next, set up Authentication. You can do this via the Anonymous method, which should be secure given you’re restricting the SMTP service to your local machine:
In the same tab, open Connection.. and include your localhost address (normally 127.0.0.1) and your server LAN address (as above).
Do the same for Relay… on the same tab:
Choose an email address for notification of un-deliverable emails:
Make a note of your SMTP Host Address via the Domains item on the left:
It should read [ServerName].[DomainName].local. E.g:
Save all and close.
Testing the SMTP server
You can test whether this is working, but opening C:\inetpub\mailroot and creating a file in there called TestEmail.txt containing the following:
Subject: Email test
is this working?
SMTP monitors this folder and sends form it. Once sent, the file disappears!
Another way you can test this is from your WordPress environemnt. Install the plugin Easy WP SMTP. Once installed, set up thus, putting in your own values:
Note the hostname saved from earlier.
Click Save and then send a test email via the Test Email tab.