Hi,
Create a SP using the below link
http://www.sqlservercentral.com/articles/SQL+Server+Agent/67726/
then use the sp_send_dbmail to send the job history when the job fails.
as below:
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'DBMail_BAP',-- provide your profile name
@execute_query_database = 'msdb',
@recipients = 'jxxxxx@corp.com',
@query = 'EXEC dbo.pr_GetStepFailureData ''provideyourJobname''' ,
@subject = 'xxxx job has been failed',
@exclude_query_output = 1,
@append_query_error = 1