Using Database Mail with SQL Server Agent
SQL Server Agent can use Database Mail to send e-mail messages. To enable and configure Database Mail accounts and profiles use the Database Mail Configuration Wizard.
To use Database Mail to send e-mail messages from SQL Server Agent Mail, you:
Enable Database Mail.
Create a Database Mail account for the SQL Server Agent service account to use.
Create a Database Mail profile for the SQL Server Agent service account to use and add the user to the DatabaseMailUserRole in the msdb database.
Set the profile as the default profile for the msdb database. For more information, see Database Mail Profiles.
Choose Database Mail as the mail system for SQL Server Agent. For more information, see How to: Configure SQL Server Agent Mail to Use Database Mail (SQL Server Management Studio).
Restart SQL Server Agent.
SQL Server Agent caches the profile information for the specified profile. This allows SQL Server Agent to send e-mail in cases where the SQL Server instance becomes unavailable. If the SQL Server instance becomes unavailable, SQL Server Agent starts the Database Mail external program directly to notify the failover operator that the instance is unavailable. Because SQL Server Agent caches profile information, SQL Server Agent does not immediately use new information when the profile changes. After changing the e-mail system, you must restart the SQL Server Agent service for the change to take effect.
|To start successfully, SQL Server Agent must be able to connect to SQL Server. Therefore, SQL Server Agent can send notifications when a running instance of SQL Server becomes unavailable, but cannot send notifications if an instance of SQL Server fails to start when the computer starts.|