Three steps are required:
1. Configure SQL Agent mail.
Http://msdn.microsoft.com/en-us/library/ms186358.aspx
In this step, the profile is configured. The profile email address is the sender of the subsequent email.
2. Create an operator.
Http://msdn.microsoft.com/en-us/library/ms175962%28v= SQL .90%29.aspx
The operator email address is the recipient who sends the email later. If multiple recipients exist, separate the email addresses with semicolons.
3. Set notification in job.
Right-click job-> properties-> notification to send an email when the job fails.
After all the configurations are complete, create a job that will certainly fail to test, such as querying a non-existent table. When the job fails to run, you can query the job history and find the error:
"NOTE: failed to your y' operator name' via email ."
This is because the SQL Agent requires enable mail profile.
Right click SQL Server Agent-> properties-> alert system-> enable checkbox of "enable mail profile". Then restart SQL Server Agent you will receive emails when jobs fail.
All the configuration process can also be achieved with T-SQL, It is very practical to configure a large number of machines Oh ~~ :
Http://www.snapdba.com/2013/04/enabling-and-configuring-database-mail-in-sql-server-using-t-sql/