Appendix D: Create the SMTP Server
Create the SMTP Server used by SQL Server Database Mail.
SQL Server Database Mail is required to configure BAM Alerts when using any of the following SQL versions:
SQL Server 2016
SQL Server 2014
SQL Server 2012
SQL Server Database Mail uses an SMTP Server to send BAM Alerts. SMTP Server is included with Internet Information Services (IIS). SMTP can be installed locally on the BizTalk Server or on another server with IIS installed.
Important
Typically, client operating systems like Windows 10, Windows 7, and so on, do not include SMTP Server capabilities. You can connect to an existing SMTP Server on a Windows Server using the SMTP E-mail feature within IIS. The SMTP E-mail feature is NOT an SMTP Server, which is required for SQL Server Database Mail. As a result, this topic does not include the steps to install and configure an SMTP Server on client operating systems.
Install and configure the SMTP server
These steps apply to:
- Windows Server 2016
- Windows Server 2012 R2
- Windows Server 2012
Install SMTP Server
In Server Manager, select Dashboard in the left pane.
Select Add roles and features. Add Roles and Features can also be opened from the Manage menu in the top right-hand corner.
In Before You Begin, select Next.
Select Role-based or feature-based installation, and select Next.
Select Select a server from the server pool, select the desired server, and select Next. The Server Selection window lists the servers that have been added using Add Server in Server Manager. By default, it selects the local server.
In Server Roles, select Next.
In Features, check SMTP Server. If prompted, select Add Features. Select Next.
In Confirmation, select Restart the destination server automatically if required, and select Install. When complete, select Close.
Configure the SMTP Server
The following steps configure the SMTP Virtual Server using the IIS 6.0 Manager:
Open the IIS Manager: In Start, search for inetmgr6.exe, and open it.
Expand the computer name. Right-click [SMTP Virtual Server #1], and select Properties.
In the Access tab, select the Relay button.
Select Add. For Single Computer, enter
127.0.0.1
, and select OK.By adding 127.0.0.1, we are allowing the local server to send messages from this SMTP Server. If you want additional computers to send messages from this SMTP server, enter their IP addresses.
In the Delivery tab, select Outbound Security. Choose from the following:
Anonymous access: An account name or password is not required. This option disables authentication for the SMTP Server.
Basic authentication: The account name and password of the server that you are connecting to are sent as clear text. This account you enter transmits the e-mails. Basic Authentication can be selected when sending e-mail to a personal account or an Exchange account. Because the credentials are passed in clear text, it is recommended to enable TLS encryption.
Integrated Windows Authentication: The Windows domain account name and password are used to authenticate. The account you enter transmits the e-mails.
TLS encryption: Similar to SSL, TLS secures the connection. Requires a valid SSL server certificate installed on this server.
Tip
To test core SMTP functionality with a personal e-mail account, including an Exchange account, select Anonymous access. When Basic authentication is selected, SMTP uses the AUTH command. Some e-mail providers may fail because of the AUTH command. If the AUTH command fails, an error may be logged in the Windows event logs on the SMTP Server.
In the Delivery tab, select Outbound connections. By default, the TCP Port is 25. A different port can be entered if it is open within your firewall. Select OK.
In the Delivery tab, select Advanced. By default, the Fully Qualified Domain Name of the local server is listed. Depending on the internet provider, the Smart Host property can remain empty. You may need to contact the internet provider to confirm if a Smart Host is required. Otherwise, you may be able to enter smtp.EMailProvider.com.
Note
A Smart Host, also known as a relay host, is a dedicated server used by an Exchange Server to route all outgoing messages. When the Smart Host receives the messages, the Smart Host forwards the messages to a remote domain. The goal of a Smart Host is to improve performance of an Exchange Server. The Exchange Server only transmits to the smart host; instead of repeatedly contacting the remote domain until a connection is made.
Select OK to close all windows.
Restart the SMTP Server: Right-click [SMTP Virtual Server #1], select Stop, and then select Start. A restart is needed to apply the SMTP Server settings.
Windows Server 2008 R2: Install and Configure SMTP Server
Install SMTP Server
The following steps install the SMTP Server feature:
In Server Manager, select Features, and select Add Features.
In Add Features, select SMTP Server. If prompted, select Add Required Role Services, and select Next.
Continue with the installation by selecting Next.
In the Confirm Installation Selections window, select Install. When complete, select Close.
Configure the SMTP Server
The following steps configure the SMTP Virtual Server using the IIS 6.0 Manager:
Open the IIS 6.0 Manager: In Start, search for IIS, and select Internet Information Services (IIS) 6.0 Manager.
Expand the computer name. Right-click [SMTP Virtual Server #1], and select Properties.
In the Access tab, select the Relay button.
Select Add. For Single Computer, enter
127.0.0.1
, and select OK.By adding 127.0.0.1, we are allowing the local server to send messages from this SMTP Server. If you want additional computers to send messages from this SMTP server, enter their IP addresses.
In the Delivery tab, select Outbound Security. Choose from the following:
Anonymous access: An account name or password is not required. This option disables authentication for the SMTP Server.
Basic authentication: The account name and password of the server that you are connecting to are sent as clear text. Basic Authentication can be selected when sending e-mail to a personal account or an Exchange account. Because the credentials are passed in clear text, it is recommended to enable TLS encryption.
Integrated Windows Authentication: The Windows domain account name and password are used to authenticate. The account you enter transmits the e-mails.
TLS encryption: Similar to SSL, TLS secures the connection. Requires a valid SSL server certificate installed on this server.
Tip
To test core SMTP functionality with a personal e-mail account, including an Exchange account, select Anonymous access. When Basic authentication is selected, SMTP uses the AUTH command. Some e-mail providers may fail because of the AUTH command. If the AUTH command fails, an error may be logged in the Windows event logs on the SMTP Server.
In the Delivery tab, select Outbound connections. By default, the TCP Port is 25. A different port can be entered if it is open within your firewall. Select OK.
Tip
The TCP Port can be used for Inbound connections and Outbound connections.
In the Delivery tab, select Advanced. By default, the Fully Qualified Domain Name of the local server is listed. Depending on the internet provider, the Smart Host property can remain empty. You may need to contact the internet provider to confirm if a Smart Host is required. Otherwise, you may be able to enter smtp.EMailProvider.com.
Note
A Smart Host, also known as a relay host, is a dedicated server used by an Exchange Server to route all outgoing messages. When the Smart Host receives the messages, the Smart Host forwards the messages to a remote domain. The goal of a Smart Host is to improve performance of an Exchange Server. The Exchange Server only transmits to the smart host; instead of repeatedly contacting the remote domain until a connection is made.
Select OK to close all windows.
A restart is needed to apply the SMTP Server settings. To restart the SMTP Server: Right-click [SMTP Virtual Server #1], select Stop, and then select Start.
Test the SMTP Server
Telnet can be used to test the SMTP Server configuration. The following steps send a message using your configured SMTP Server to an e-mail address. For more information on the telnet commands, go to Windows commands: telnet.
Open a command window as Administrator.
In the command prompt, type:
telnet localhost 25
If telnet is not installed, install it by typing:
pkgmgr /iu:"TelnetClient"
Start communication by typing:
EHLO server
Enter the Mail From address:
MAIL FROM: *YourEmailAddress*@*YourProvider*.com
For example, enter:
MAIL FROM: EmailAddress@outlook.com
Enter the Mail To address:
RCPT TO: *YourEmailAddress*@*YourProvider*.com
For example, enter:
RCPT TO: EmailAddress@outlook.com
Tell the SMTP Server you are ready to send data by typing:
DATA
Enter the Subject by typing:
Subject: Test Message
Hit Enter twice.
Enter the message body by typing:
This is the message body of the test message.
Hit Enter, type a period (.), and hit Enter.
Check the RCPT TO address for the e-mail message. If the e-mail is not delivered (Check your Inbox and Spam folder), then the message was not successfully sent, and may reside in the SMTP Queue folder (C:\inetpub\mailroot\Queue).