Dela via


SQL Mail

SQL Mail is provided in Microsoft SQL Server for backward compatibility. To send mail from SQL Server, use Database 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 from SQL Server, use Database Mail.

Security noteSecurity Note

SQL Mail is not installed by default in SQL Server. For more information, see Understanding Surface Area Configuration. SQL Mail is not supported on 64-bit versions of SQL Server. SQL Mail stored procedures cannot be installed on 64-bit versions.

SQL Mail provides a mechanism to send, receive, delete, and process e-mail messages. Messages can be triggered to provide a recipient with a particular result set from a specified SQL Server query. SQL Mail also provides mechanisms to read or delete e-mail messages. Establishing a client connection with a mail server that implements Extended MAPI allows you to perform all of these operations.

SQL Mail uses Extended MAPI client components from an external e-mail application (for example, Microsoft Outlook) to send and receive e-mail. Therefore, to use SQL Mail, you must install an e-mail application that supports Extended MAPI on the computer that runs SQL Server. SQL Server uses the Extended MAPI components provided by the e-mail application to communicate with the e-mail server.

Note

SQL Authenticated users of SQL Mail can send mail attachments only if they are members of the sysadmin fixed server role.

SQL Mail requires a post office connection, a mail store (mailbox), a mail profile, and the Microsoft Windows domain user account used to log in to an instance of SQL Server. (The user account must be in the same domain as SQL Server.) The MSSQLServer service must be started with this domain user account. Using SQL Mail extended stored procedures, messages can be sent from either a trigger or a stored procedure. SQL Mail stored procedures can process queries received by e-mail and return the result set by creating a reply e-mail.

Security noteSecurity Note

For enhanced security, you should limit permissions for all SQL Mail stored procedures and extended stored procedures to members of the sysadmin fixed server role.

See Also

Concepts