There are 3 or more ways that can be followed to successfully install SMTP service on Windows Server 2008 R2. Most administrators use the ‘Server Manager’ GUI to achieve this. In addition to the GUI, you can also use the ‘servermanagercmd’ commandlet or Windows PowerShell to accomplish same task.
For the purpose of this post I will install SMTP service using PowerShell.
1. Installing SMTP Components and Features
- Click on Start → All Programs → Accessories → Windows PowerShell → Right-click on Windows PowerShell → click on Run as administrator
- Enter the following command ‘powershell.exe -ImportSystemModules add-windowsfeature smtp-server‘ → Enter
- System will begin installation. Ignore any warming shown during the modules import
- After installation is completed → restart the server
2. Configure SMTP
- Click on Start → Run → Type ‘inetmgr6′ and press OK or simply click on Start → Administrative Tools → Internet Information Services (IIS) 6.0 Manager
- Expand the server name → right-click on ‘SMTP Virtual Server #..’ and click Properties
- Under General tab → If you have multiple IP address the select one server will listen to for SMTP requests or leave as default
- Click Access tab → click Relay…
- On Relay Restriction screen → Ensure ‘Only the list below’ option is selected → click Add… → Enter the loopback IP (127.0.0.1) → click OK
- Click on Delivery tab → Advanced… button → change the Fully-qualified domain name to a friendly name (Note: ensure that new name is configured on your internal or external DNS provider) → click Check DNS → ensure you get a valid domain message. Also if you use a smarthost enter details
Note: the SMTP service is not started, so this needs to started before it can function
3. Send test email
- Open PowerShell as an administrator → enter the following command and execute it
Send-MailMessage –SMTPServer <SMTP server name> -To sysads@hotmail.com –From admin@sysads.co.uk –Subject “This is a test e-mail” –Body “This is a test from your alert system!”