• I am using the following trigger I found on SQL Server Central.

    USE [msdb]

    GO

    SET ANSI_NULLS ON

    GO

    SET QUOTED_IDENTIFIER ON

    GO

    ----------------------------------------------------------------------------

    -- Object Type : Trigger

    -- Object Name : msdb..trg_stepfailures

    -- Description : Send notifications on job STEP failures (trigger)

    -- Author : http://www.sqlservercentral.com By Kenneth Singer

    -- Date : August 2009

    ----------------------------------------------------------------------------

    CREATE trigger [dbo].[trg_stepfailures]

    on [dbo].[sysjobhistory]

    for insert

    as

    declare @strMsg varchar(400),

    @strRecipient varchar(128),

    @copyRecipient varchar(128),

    @bccRecipient varchar(128)

    set @strRecipient = 'recipient@company.com'

    set @copyRecipient = 'recipient@company.com'

    set @bccRecipient = ''recipient@company.com'

    if exists (select * from inserted where run_status = 0 and step_name '(job outcome)')

    begin

    select @strMsg =

    convert(char(10),'Server') + char(58) + @@servername +

    char(10) +

    convert(char(10),'Job') + char(58) + convert(varchar(50), sysjobs.name) +

    char(10) +

    convert(char(10),'Step') + char(58) + convert(varchar(50), inserted.step_name)+

    char(10) +

    convert(char(10),'Message') + char(58) + convert(varchar(150), inserted.message)

    frominserted

    joinsysjobs

    oninserted.job_id = sysjobs.job_id

    whereinserted.run_status = 0

    raiserror (@strMsg, 16, 10) with log

    exec msdb.dbo.sp_send_dbmail

    @recipients = @strRecipient,

    @copy_recipients = @copyRecipient,

    @blind_copy_recipients = @bccRecipient,

    @body = @strMsg,

    @subject = 'Job Failure'

    end