476 database mail is not enabled for agent notifications

A classic SQL Server error!

The error message "476: Database Mail is not enabled for agent notifications" typically occurs when you're trying to configure SQL Server Agent to send notifications via email, but the Database Mail service is not enabled or configured correctly.

Here are some steps to help you resolve this issue:

  1. Check if Database Mail is enabled: Run the following T-SQL command to check if Database Mail is enabled:

    SELECT * FROM msdb.dbo.sysmail_accounts

    If the result set is empty, it means Database Mail is not enabled.

  2. Enable Database Mail: To enable Database Mail, run the following T-SQL command:

    EXEC msdb.dbo.sp_configure 'show advanced options', 1
    RECONFIGURE
    EXEC msdb.dbo.sp_configure 'Database Mail XPs', 1
    RECONFIGURE

    This will enable the Database Mail feature.

  3. Configure Database Mail: After enabling Database Mail, you need to configure it. Run the following T-SQL command to configure the Database Mail:

    EXEC msdb.dbo.sp_send_dbmail @profile_name = 'Your_Profile_Name'

    Replace Your_Profile_Name with the name of the profile you want to use for sending emails.

  4. Check the SQL Server Agent service: Make sure the SQL Server Agent service is running and configured correctly. You can check the service status by running the following command:

    NET START sqlserveragent

    If the service is not running, start it and try again.

  5. Verify the notification settings: Check the notification settings for the SQL Server Agent job that's trying to send the email. Make sure the email settings are correct and the job is configured to use the correct profile.

If you've followed these steps and still encounter the issue, you can try checking the SQL Server error logs for more detailed information about the error.