Handle smtp errors gracefully