Better error handling for mail