TN WW155 How to send an email when a SQL Server job has a failure
Description
This article from InSource shows how to send an email when a SQL Server job has had a failure. This is useful when you are establishing a maintenance plan and would like to be notified by email when some part of the plan does not complete successfully.
- Author: Joseph Hefner
- Published: 3/29/2016
- Applies to: SQL Server 2005 and later
Details
* This article assumes you have already created a database mail account in order to send emails from within SQL Server. If you have not yet done so you will need to create a database mail account before following the steps below.
Step 1) Create a new Operator if none exists.
This is done by Right Clicking on the "Operators" folder and choosing "New Operator":
Step 2) Give a name and email address to the Operator and click the "Enabled" checkbox:
This will be the email address where the job failure alerts will be sent. If you need to send it to more than one address you can make this an email group that goes to multiple email addresses.
Step 3) Under the jobs folder right click each job that you wish to send an email alert for and choose "Properties".
Step 4) Click the Notifications page and select the checkbox for "Email". Next choose the Operator created in Step 2 and choose "When the job fails" and then click the "OK" button.