BizTalk Server 2013 R2: Installation and Configuration – Configure SQL Server Database Mail feature (Part 8)

Posted: January 12, 2015 in BizTalk
Tags: , , , ,

This next posts will focus on installing the BizTalk prerequisites and perform the necessary configuration on BizTalk Server machine.

Before installing BizTalk Server or its prerequisites, make sure you have installed the latest critical Windows updates from Microsoft.

Configure SQL Server Database Mail feature

If you wish to configure BAM Alerts on your BizTalk Server 2013 R2 environment then you must already have configured SQL Server Database Mail feature before you try to configure BAM Alerts, otherwise the BizTalk Basic configuration will ignore this feature (BAM Alerts). This is because BAM Alerts with SQL Server 2014 or SQL Server 2012 uses Database Mail in SQL Server instead of SQL Notification Services that were used by previous versions of BizTalk Server with SQL Server 2008 R2 or bellow.

Database Mail is an enterprise solution for sending e-mail messages from the SQL Server Database Engine. Using Database Mail, your database applications can send e-mail messages to users. The messages can contain query results, and can also include files from any resource on your network. You can read more here: http://msdn.microsoft.com/en-us/library/ms189635.aspx

Note: You still can have BAM Portal with activities and aggregations without alerts, this is mandatory if you want alerts.

Before we begin, we need to determine the server name and port number for the Simple Mail Transfer Protocol (SMTP) server that we will use to send e-mail (If the SMTP server requires authentication, determine the user name and password for the SMTP server). In our case will be the local SMTP Server that we previous install and configure.

To Configure SQL Server Database Mail Account:

  • Press the “Windows key” to switch to the Start screen, type “SQL Management” or “SQL” and click in “SQL Server Management Studio” option from the Search menu

40-bts-2013-r2-search-sql-server-management-studio-2014

  • In Object Explorer panel, connect to the SQL Server instance you want to configure Database Mail on, and expand the server tree.
    • Expand the “Management” node

41-bts-2013-r2-sql-server-management-studio-2014-object-explorer-database-mail

  • Double click “Database Mail” to open the Database Mail Configuration Wizard.
    • Or right click under “Database Mail” and select the option “Configure Database Mail”

42-bts-2013-r2-sql-server-management-studio-2014-object-explorer-configure-database-mail

  • On the Welcome to Database Mail Configuration Wizard page, click “Next” to continue

43-bts-2013-r2-sql-server-2014-database-mail-welcome-database-mail-configuration

  • On the Select Configuration Task page, select “Set up Database Mail by performing the following tasks:” and click “Next” to continue.
    • Set up Database Mail by performing the following tasks: Perform all of the tasks required to set up Database Mail for the first time. This option includes all of the other three options.
    • Manage Database Mail accounts and profiles: Create new Database Mail accounts and profiles or to view, change, or delete existing Database Mail accounts and profiles.
    • Manage profile security: Configure which users have access to Database Mail profiles.
    • View or change system parameters: Configure Database Mail system parameters such as the maximum file size for attachments.

44-bts-2013-r2-sql-server-2014-database-mail-select-configuration-task

  • If Database Mail has not been enabled, you will receive the message: “The Database Mail feature is not available. Would you like to enable this feature?” Click “Yes” to continue.

45-bts-2013-r2-sql-server-2014-database-mail-select-configuration-task-message

  • On the New Profile page, specify the “Profile name” and “Description” to be included in the profile, and click “Add…” to specify an account

46-bts-2013-r2-sql-server-2014-database-mail-new-profile

  • On the New Database Mail Account page, specify the account name, description, mail server information, and authentication type. Click “OK”
    • A Database Mail account contains the information that SQL Server uses to send e-mail messages to an SMTP server. Each account contains information for one e-mail server and doesn’t correspond to a SQL Server account or a Microsoft Windows account. Database Mail can be sent using the credentials of the SQL Server Database Engine, using other credentials that you supply, or anonymously. When using basic authentication, the user name and password in a Database Mail account are only used for authentication with the e-mail server. An account need not correspond to a SQL Server user or a user on the computer running SQL Server.
      • Account name: Type the name of the new account.
      • Description: Type a description of the account. The description is optional.
      • E-mail address: Type the name of the e-mail address for the account. This is the e-mail address that e-mail is sent from. For example, an account for SQL Server Agent may send e-mail from the address SqlAgent@Adventure-Works.com.
      • Display name: Type the name to show on e-mail messages sent from this account. The display name is optional. This is the name displayed on messages sent from this account. For example, an account for SQL Server Agent may display the name “SQL Server Agent Automated Mailer” on e-mail messages.
      • Reply e-mail: Type the e-mail address that will be used for replies to e-mail messages sent from this account. The reply e-mail is optional. For example, replies to an account for SQL Server Agent may go to the database administrator, danw@Adventure-Works.com.
      • Server name: Type the name or IP address of the SMTP server the account uses to send e-mail. Typically this is in a format similar to smtp.<your_company>.com. For help with this, consult your mail administrator. As I say early we will use our local SMTP Server, so the server name will be “localhost”
      • Port number: Type the port number of the SMTP server for this account. Most SMTP servers use port 25.
      • This server requires a secure connection (SSL): Encrypts communication using Secure Sockets Layer.
      • Windows Authentication using Database Engine service credentials: Connection is made to the SMTP server using the credentials configured for the SQL Server Database Engine service.
      • Basic Authentication: Specify the user name and password required by the SMTP server.
      • Anonymous authentication: Mail is sent to the SMTP server without login credentials. Use this option when the SMTP server does not require authentication.

47-bts-2013-r2-sql-server-2014-database-mail-new-database-mail-account

  • Back on the New Profile page, click “Next” to continue

48-bts-2013-r2-sql-server-2014-database-mail-new-profile-back

  • On the Manage Profile Security page, you will be able to set the Public, Private and Default Profiles, select our profile as public and default and click “Next”.

49-bts-2013-r2-sql-server-2014-database-mail-manage-profile-security

  • On the Configure System Parameters page, leave the default values and click “Next”

50-bts-2013-r2-sql-server-2014-database-mail-configure-system-parameters

  • On the Complete the Wizard page, review the actions to be performed and click “Finish” to complete creating the new account.

51-bts-2013-r2-sql-server-2014-database-mail-complete

  • On the “Configuring…” page, ensure that all actions succeed and then click “Close”

52-bts-2013-r2-sql-server-2014-database-mail-configuring

The Database Mail should now be configured successfully and all should be correctly setup to send emails, but we must make sure by testing it. So we will send a test email and confirm the reception. To do that:

  • Right-click on Database Mail and select “Send Test E-Mail…”

53-bts-2013-r2-sql-server-2014-database-mail-send-test-e-mail

  • On the Send Test E-mail from windows, specify a “To:” email and click “Send Test E-Mail”

54-bts-2013-r2-sql-server-2014-database-mail-send-test-e-mail-parameters

The Database Mail Test E-Mail dialog box confirms that the test message that Database Mail attempted to send the message and provides the mailitem_id for the test e-mail message. Check with the recipient to determine if the e-mail arrived. Normally e-mail is received in a few minutes or seconds. If you have received the email, you have been able to configure Database Mail successfully, but the e-mail can be delayed because of slow network performance, a backlog of messages at the mail server, or if the server is temporarily unavailable. Use the mailitem_id for troubleshooting.

Related links
Comments
  1. r says:

    I am getting an error could not connect to mail server. no connection could be made because the target machin actively refused it 127.0.01:25 while sending a test mail.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s