Today, I received an email from the development team complaining why they have not received any of the SQL Agent job notification emails today. Upon checking the SQL Agent error log, I see the following error message:
[264] An attempt was made to send an email when no email session has been established.
To investigate the issue, I followed the steps below to verify that SQL Server Agent Alert System is configured correctly and is associated with the correct Database Mail profile:
- Right Click on SQL Server Agent, Select properties.
- Select Alert System.
- Select Enable mail profile.
- Select OK.
I also successfully sent a test email using this Database Mail profile.
Although, I verified above settings and sent test emails using Database Mail, SQL Server Agent Job was still unable to notify the SQL Server Agent Operator. At this point, I decided to Google this error message because I was not sure why this error is occurring. After digging around online, I realized I just need to restart the SQL Server Agent service. After I restarted SQL Server Agent service, SQL Server Agent job notifications started working again.