Using proper status code for error during sending of email