SQL Server 2005 Maintenance Plans not sending email alerts?

SQL Server 2005 does make it much easier to set up email alerts than it's predecessors, however its still very easy to set it up in such a way that emails generated by SQL Agent are not sent, despite test emails being sent without any difficulty.

If your SQL Agent jobs are not sending out emails, and you have set up mail accounts and profiles, together with specifying at least one operator with an email address, and you are getting the following errors in your error logs:

[260] Unable to start mail session (reason: No mail profile defined)

[264] An attempt was made to send an email when no email session has been established

You need to do the following:

  • Right click on SQL Server Agent within Management Studio
  • Select Properties
  • Select Alert System
  • Tick the Enable mail profile checkbox
  • Select Database Mail from the Mail System: select box
  • Select the Mail Profile you wish to use for SQL Agent emails

I believe you then need to restart SQL Server Agent - and providing your profile is set up correctly (and firewall rules permitting) SQL Agent jobs should now send out emails correctly :)

After doing this, it's probably worth checking that emails are working correctly - to do this I set up a simple SQL Agent job containing a single step with a simple select statement, and configured the job to send me an email on completion.  I then ran the task manually, and checked to see the email was received successfully.

Comments
BlogCFC was created by Raymond Camden. This blog is running version 5.5.1, hosted by TalkWebSolutions.