handle exceptions
create file if send mail is failing