Today in the early morning I received a call from an old DBA friend of mine. He was having some issues to send alert mails. He configured the Database Mail and created the operators and some Alerts as well to send email to those operators when those alerts were triggered. But he was not receiving any emails sent by the alerts.
I told him to check the SQL Agent error log and he told me that he is getting the below error in the error log:
I understood the issue. We have to set up SQL Server Agent to use Database Mail. As my friend had already configured Database Mail and tested it, so only one vital piece was missing, I told him to carry out the following steps and that worked as expected:
- Right-click SQL Server Agent, and then click Properties.
- Click Alert System.
- Select Enable Mail Profile.
- In the Mail system list, select Database Mail.
- In the Mail profile list, select a mail profile for Database Mail.
- Restart SQL Server Agent.