fixes and improvements for SMTP error logging