Lezen in het Engels

Delen via


SQL Server Agent Mail

SQL Server Agent includes the ability to send e-mail. You can configure SQL Server Agent Mail to send e-mail messages to predefined operators when:

  • An alert is triggered. Alerts can be configured to send e-mail notification of specific events that occur. For example, alerts can be configured to notify an operator of a particular database event or operating system condition that may need immediate action. For more information about configuring alerts, see Defining Alerts.

  • A scheduled task, such as a database backup or replication event, succeeds or fails. For example, you can use SQL Server Agent Mail to notify operators if an error occurs during processing at the end of a month.

E-mail messages can be sent to a list of recipients informing them of the status of scheduled jobs for possible user action. For example, you can configure SQL Server Agent to send e-mail when a backup job completes.

SQL Server Agent Mail is off by default. To configure it, use the Alert System pane of the SQL Server Agent Properties dialog. Notice that SQL Server Agent Mail is only required for alert notifications and automatic notification when a job completes. Individual job steps within a job can also send e-mail, regardless of whether SQL Server Agent Mail is on. For example, a Transact-SQL job step can use Database Mail to send the results of a query to a list of recipients.

SQL Server Agent Mail supports two e-mail systems. When you configure SQL Server Agent Mail, you choose the mail system to use:

  • When you choose Database Mail, SQL Server Agent uses Database Mail to send e-mail.

  • When you choose SQL Mail, SQL Server Agent uses the Extended MAPI interface to send e-mail.

    Notitie

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

After changing the e-mail system, you must restart the SQL Server Agent service for the change to take effect.

See Also

Concepts