Fix bug with logged attribute name; improve SMTP error handling