better mail error handling