Configuring Extended MAPI Mail Profiles

This section describes how to configure an Extended MAPI mail profile for use with SQL Mail or SQL Server Agent Mail.

Note

This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature.. To send mail use Database Mail.

Configuring a Profile for SQL Mail

Extended MAPI mail profiles are specific to the Microsoft Windows user domain account that is activated when a user logs on to Windows. SQL Mail must have a mail profile created in the same domain user account that is used to start an instance of SQL Server. When a SQL Mail stored procedure is run, SQL Mail looks for the defined mail profile in the domain account that triggered it.

If you plan to use SQL Mail stored procedures you must:

  • Have a mail server that is Extended MAPI compliant.

  • Configure a mail profile for The SQL Server (MSSQLSERVER) service to use to connect to your mail server.

    Security noteSecurity Note

    For security reasons, ensure that users do not share the same temporary directory. Failure to change the suppress_attach parameter to TRUE when using the xp_readmail stored procedure creates attachments in the temporary directory. If two users share the same temporary directory and log on to the same computer, they will be able to view each other's attachments. You can determine where attachments are stored, and whether two users share the same temporary directory, by reviewing the attachments output variable. See xp_readmail (Transact-SQL) for more details on suppressing attachments.

Configuring a SQL Server Agent Mail Profile (Extended MAPI)

To use Extended MAPI with SQL Server Agent Mail, you must:

  • Install SQL Mail.

  • Have a mail server that is Extended MAPI compliant.

  • Configure an Extended MAPI mail profile for SQL Server Agent to use to connect to your mail server.

  • Have a mail server that is able to communicate with your pagers.

  • Select SQL Mail as the mail system for SQL Server Agent.

When SQL Server Agent Mail uses Extended MAPI, a mail profile is required to start a mail session and send notification by e-mail or pager. A SQL Server Agent Mail session is started every time that the SQL Server Agent service is started. You can create the profile with a mail client, such as Microsoft Outlook, that is installed locally on the instance of SQL Server.

Sharing a Profile Between SQL Mail and SQL Server Agent Mail (Extended MAPI)

SQL Mail and SQL Server Agent Mail sessions can be configured to use the same Windows domain user account. When using the same domain account, SQL Mail and SQL Server Agent Mail can share the same mail profile using a common mailbox.

SQL Server uses two separate mail sessions:

  • MSSQLSERVER uses a mail session that is referred to as SQL Mail.

    SQL Server uses this mail session when database applications run the xp_sendmail extended stored procedure to send a message or query result set to a recipient.

  • SQL Server Agent Mail uses a mail session that is exclusive to SQL Server Agent activities.

Creating Separate Profiles for SQL Mail and SQL Server Agent Mail (Extended MAPI)

You can configure separate mailboxes for SQL Mail and SQL Server Agent Mail by creating separate mail profiles. There are two ways to accomplish this:

  • Use separate domain accounts for each service. This requires you to configure a mail profile for each user account.

  • Use the same domain account for each service and create multiple mail profiles.

For more information about setting up and configuring mail clients and mail profiles, see the Microsoft Outlook documentation.

SQL Mail and SQL Server Agent Mail can use the same or different MAPI profiles. If necessary, each mail profile can be configured within its own domain account.