improved error handling for mailing notifications