Added logic to catch exceptions while sending email