Added emailing at the end of the job.