Appendix D: Create the SMTP Server – Microsoft Learn

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 versions of

SQL: SQL Server 2016 SQL Server 2014 SQL Server 2012 SQL Server

  • 2012

  • SQL Server Database

  • Mail

  • uses an SMTP server to send BAM alerts. The SMTP server is included with Internet Information Services (IIS). SMTP can be installed locally on BizTalk Server or on another server with IIS installed.

Install and

configure

the SMTP server

These steps apply to:

Windows Server 2016 Windows Server 2012

    R2

  • Windows Server 2012

Install

the SMTP server

  1. In Server Manager, select Dashboard in the left pane

  2. .

  3. Select Add roles and features. Adding roles and features can also be opened from the Manage menu in the upper right corner.

  4. Under Before you begin,

  5. select Next. Select

  6. Role-based or feature-based installation

  7. and select Next. Select

  8. Select a server from the server group, 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, select the local server.

  9. Under

  10. Server Roles, select Next

  11. .

  12. Under Features, turn on SMTP Server. If prompted, select Add Features. Select Next.

  13. Under Confirmation, select Restart the destination server automatically if necessary, and select Install. When you’re done, select Close.

Configure

the SMTP server

The following steps configure the SMTP virtual server by using

IIS 6.0 Manager:

  1. Open IIS Manager: On Start, locate inetmgr6.exe and open it

  2. .

  3. Expand the computer name. Right-click [SMTP Virtual Server #1] and select Properties.

  4. On the Access tab, select the Relay button

  5. .

  6. Select Add. For Single Computer, type 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 other computers to send messages from this SMTP server, enter their IP addresses.

  7. On the Delivery tab, select Outbound Security. Choose one of the following options

    :

    Anonymous access: No account name or password required. This option disables authentication for the SMTP server.

    Basic authentication: The account name and password of the server you are connecting to are sent in clear text. This login account transmits the emails. Basic authentication can be selected when sending email to a personal account or to an Exchange account. Because credentials are passed in clear text, we recommend that you enable TLS encryption.

    Integrated Windows authentication: The domain account name and Windows password are used to authenticate. The account you enter transmits the emails.

    TLS encryption: Similar to SSL, TLS secures the connection. Requires a valid SSL server certificate installed on this server.

  8. On the Delivery tab, select Outbound Connections. By default, TCP port is 25. A different port can be entered if it is open inside your firewall. Select OK.

  9. On the Delivery tab, select Advanced. By default, the Fully Qualified Domain Name of the local server appears. Depending on the Internet provider, the Smart Host property may remain empty. You may need to contact your Internet provider to confirm if a smart host is required. Otherwise, you may be able to enter smtp.EMailProvider.com.

  10. Select OK to close all windows

  11. .

  12. Restart the SMTP server: Right-click [SMTP Virtual Server #1], select Stop, and then select Start. A restart is required to apply SMTP server settings.

Windows Server 2008 R2

: Install and configure the SMTP server Install the SMTP

server

The following steps install the

SMTP Server feature: In Server Manager, select Features and select Add Features.

    Under

  1. Add

  2. Features, select SMTP Server. If prompted, select Add required role services and select Next.

  3. Continue with the installation by selecting Next

  4. .

  5. In the Confirm Installation Selections window, select Install. When you’re done, select Close.

Configure

the SMTP server

The following steps configure the SMTP virtual server by using

IIS 6.0 Manager: Open IIS 6.0 Manager

  1. : On Start, locate IIS and select Internet Information Services (IIS) 6.0 Manager.

  2. Expand the computer name. Right-click [SMTP Virtual Server #1] and select Properties.

  3. On the Access tab, select the Relay button

  4. .

  5. Select Add. For Single Computer, type 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 other computers to send messages from this SMTP server, enter their IP addresses.

  6. On the Delivery tab, select Outbound Security. Choose one of the following options

    :

    Anonymous access: No account name or password required. This option disables authentication for the SMTP server.

    Basic authentication: The account name and password of the server you are connecting to are sent in clear text. Basic authentication can be selected when sending email to a personal account or to an Exchange account. Because credentials are passed in clear text, we recommend that you enable TLS encryption.

    Integrated Windows authentication: The domain account name and Windows password are used to authenticate. The account you enter transmits the emails.

    TLS encryption: Similar to SSL, TLS secures the connection. Requires a valid SSL server certificate installed on this server.

  7. On the Delivery tab, select Outbound Connections. By default, TCP port is 25. A different port can be entered if it is open inside your firewall. Select OK.

  8. On the Delivery tab, select Advanced. By default, the Fully Qualified Domain Name of the local server appears. Depending on the Internet provider, the Smart Host property may remain empty. You may need to contact your Internet provider to confirm if a smart host is required. Otherwise, you may be able to enter smtp.EMailProvider.com.

  9. Select OK to close all windows

  10. .

  11. A restart is required to apply SMTP server settings. To restart the SMTP server: Right-click [SMTP Virtual Server #1], select Stop, and then select Start.

Test SMTP Server

Telnet can be used to test SMTP server configuration. The following steps send a message through the configured SMTP server to an e-mail address. For more information about telnet commands, go to Windows Commands: telnet.

  1. Open a command window as an administrator.

  2. At the command prompt

    , type: telnet

    localhost 25

    If telnet is not installed, install it by

    typing:

    pkgmgr /iu:”TelnetClient”

  3. Start the communication by typing

    :

    EHLO Server

    Enter the

  4. email address of: MAIL FROM: *YourEmailAddress*

  5. @*

    YourProvider*.com

    For example, type

    :

    MAIL FROM: EmailAddress@outlook.com

  6. Enter the email address to: RCPT TO: *

  7. YourEmailAddress*@*YourProvider*.com

    For example, type

    :

    RCPT TO: EmailAddress@outlook.com

  8. Tell the SMTP server that you are ready to send data

  9. by typing: DATA Enter the subject by typing: Subject: Test message

  10. Press Enter twice

  11. . Enter the

  12. message body by typing:

    This is the body of

  13. the

    test

  14. message.

  15. Press Enter, type a period (.) and press Enter

    .

    Check the RCPT TO address for the e-mail message. If the email is not delivered (Check your Inbox and Spam folder), the message was not sent successfully and may reside in the SMTP queue folder (C:\inetpub\mailroot\Queue).