Added try catch in mail part in generate receipt