(when (setq result
(smtpmail-via-smtp
smtpmail-recipient-address-list tembuf))
- (error "Sending failed: %s" result))
+ (error "Sending failed: %s"
+ (smtpmail--sanitize-error-message result)))
(error "Sending failed; no recipients"))
(let* ((file-data
(expand-file-name
(when (setq result (smtpmail-via-smtp
smtpmail-recipient-address-list
(current-buffer)))
- (error "Sending failed: %s" result))
+ (error "Sending failed: %s"
+ (smtpmail--sanitize-error-message result)))
(error "Sending failed; no recipients"))))
(delete-file file-data)
(delete-file file-elisp)
(delete-region (point-at-bol) (point-at-bol 2)))
(write-region (point-min) (point-max) qfile))))
+(defun smtpmail--sanitize-error-message (string)
+ "Try to remove passwords and the like from SMTP error messages."
+ (replace-regexp-in-string "\\bAUTH\\b.*" "AUTH" string))
+
(defun smtpmail-fqdn ()
(if smtpmail-local-domain
(concat (system-name) "." smtpmail-local-domain)