You can set up an SMTP server utilizing built-in instruments in all variations of Windows Server. This SMTP server can work as a mail relay service that ought to obtain and ship SMTP emails from numerous gadgets within the group (for instance, senders, scanners, entry management gadgets, and so forth.) and functions (internet apps, SQL Reporting Services, SharePoint), which ought to have the ability to ship mail utilizing the SMTP protocol. Such a relay can ship messages to your Exchange servers or to public e-mail companies equivalent to Gmail, Yahoo, Office 365 (outlook.com), and so forth. (since it isn’t at all times advisable to deploy a full-featured inner e-mail infrastructure primarily based on Microsoft Exchange Server or different e-mail companies).
In this text we’ll present how to set up, configure and check the SMTP server on Windows Server 2012 R2, 2016 and 2019 serving as a mail relay. This SMTP server can solely ship or ahead emails, and there aren’t any consumer mailboxes on it.
How to Install SMTP Service on Windows Server 2016 / 2012 R2?
SMTP service is without doubt one of the built-in options of Windows Server that may be put in via Server Manager. To do it, open the Server Manager Dashboard (servermanager.exe), go to Add roles and options and examine SMTP Server when you choose the options to set up. To handle the SMTP service, set up the administration consoles, being part of Web Server (IIS) position, so you may be prompted to set up some IIS elements.
Leave all of the advised choices of the Web Server (IIS) position and run set up.
You may also set up an SMTP server utilizing the PowerShell command:
After the elements are put in, you could want to restart your server.
Configuring SMTP Server on Windows Server
The SMTP server continues to be managed utilizing the old-fashioned administration console Internet Information Services (IIS) Manager 6. You can open this console from the Server Manager: Tools-> Internet Information Services (IIS) 6.zero Manager or with the command inetmgr6.exe.
Expand the department along with your server nam within the IIS 6 Manager, right-click SMTP Virtual Server and open its properties.
On the General tab, if essential, choose the IP deal with on which the SMTP server ought to reply (if the server has ), and examine the choice Enable logging (so as to save details about all obtained emails to textual content log information).
Then go to the Access tab.
Here click on the Authentication button and guarantee that the Anonymous entry is enabled.
Go again to the Access tab and click on the Connection button. Here you may specify the IP addresses of gadgets which can be allowed to ship emails via your SMTP relay. To do it, examine the Only the record under and specify the record of IP addresses (subnets), don’t overlook about your self (127.zero.zero.1).
Configure the identical approach the record of allowed IPs within the Relay settings (click on the corresponding button). This part signifies which IP addresses (or subnets) can relay e-mail via your SMTP server.
Note. As a normal rule, it’s value to examine this choices and restrict the record of accepted gadgets with the vary of IP addresses. Otherwise, your SMTP server could also be utilized by spammers and different attackers as an open relay for mass mailings.
Go to the Messages tab. Here the executive e-mail deal with is specified, to which the copies of all NDR messages will probably be ship (Send copy of Non-Delivery Report to:). Also right here you may specify the restrictions on the utmost message measurement (Limit message measurement KB) and the utmost variety of recipients (Limit variety of recipients per message).
Go to the Delivery tab.
Then click on Outbound Security.Here you specify the best way of authentication on the exterior mail server to which your SMTP server will ship (relay) all e-mail messages. For instance, if all emails will probably be ahead to Gmail mail server and then despatched to the recipients, you want to examine the Basic authentication and specify your Gmail mailbox credentials (you will need to permit to ship e-mail by way of Gmail SMTP within the Google account settings).
Then click on Advanced.
Here you specify the FQDN identify of your SMTP server. Click the Check DNS button to guarantee that the DNS document is legitimate.
If your server sends mail to an exterior SMTP server, specify its identify within the Smart host area (for instance, smtp.gmail.com or smtp.workplace365.com).
Some public mail servers settle for e-mail solely when utilizing a safe SMTP connection utilizing TLS Encryption (TCP port 587). You can configure this setting within the part Delivery-> Outbound Security and Outbound Connections. Read the documentation of your e-mail supplier.
Save the SMTP server settings and restart your SMTP digital service to apply the adjustments.
- The DNS settings are essential from the perspective of e-mail system health. If your SMTP server can’t appropriately resolve DNS names of domains to which it’s attempting to ship e-mail, the supply will fail.
- If your server sends mail to different domains, it is necessary that the proper PTR document is created on your IP deal with so as to resolve reverse DNS lookups. The PTR document on your ought to level to your server FQDN identify. Otherwise, most exterior SMTP servers received’t settle for e-mail from you, contemplating your server a spammer one.
SMTPSVC Service Auto-Start
It stays to configure the automated startup of SMTP service on your Windows Server. You can do it rapidly utilizing the PowerShell command immediate:
set-service smtpsvc -StartupType Automatic
Start the service:
Make certain that the SMTPSVC service is operating:
Status Name ShowName
—— —- ————
Running smtpsvc Simple Mail Transfer Protocol (SMTP)
Testing the SMTP Server on Windows
The last item you might have to do is to guarantee that your SMTP server is working. It is less complicated to do it by making a plain-text file smtp-test-email.txt on your desktop and copying the next textual content to it. Don’t overlook to change the sender and recipient names to yours.
Copy the file smtp-test-email.txt to the C:inetpubmailrootPickup folder. The Windows SMTP server displays new information showing on this folder, and if a file is discovered it’ll learn it contents and strive to ship an e-mail with the given topic and physique to the recipient specified within the To: line.
Check the recipient mailbox, and you will note this e-mail.
If you might have enabled Basic Authentication to authenticate all of your SMTP shoppers (as an alternative of nameless authentication), you may ship an e-mail with the smtp authentication by way of telnet as .
Also, guarantee that TCP 25 port is just not blocked on your SMTP server by the native firewall or anti-virus software program. The easiest method to do that is from a Windows-based pc whose IP deal with has been added to the allowed connection record. Check availability of port 25 utilizing the cmdlet:
Test-WebConnection smtprelay.woshub.com –port 25
If port 25 is blocked, examine the settings of Windows Firewall, antivirus and firewalls.
So you might have configured your personal SMTP mail relay on Windows Server 2016 / 2012 R2 and examined sending emails via it.