diff options
Diffstat (limited to 'lisp/mail')
-rw-r--r-- | lisp/mail/feedmail.el | 17 | ||||
-rw-r--r-- | lisp/mail/smtpmail.el | 28 |
2 files changed, 29 insertions, 16 deletions
diff --git a/lisp/mail/feedmail.el b/lisp/mail/feedmail.el index babc3fc212a..b362614d3a0 100644 --- a/lisp/mail/feedmail.el +++ b/lisp/mail/feedmail.el @@ -17,15 +17,6 @@ ;; ability to queue messages for later sending. This replaces ;; the standalone fakemail program that used to be distributed with Emacs. -;; feedmail works with recent versions of Emacs (20.x series) and -;; XEmacs (tested with 20.4 and later betas). It probably no longer -;; works with Emacs v18, though I haven't tried that in a long -;; time. Makoto.Nakagawa@jp.compaq.com reports: "I have a report -;; that with a help of APEL library, feedmail works fine under emacs -;; 19.28. You can get APEL from ftp://ftp.m17n.org/pub/mule/apel/. -;; you need apel-10.2 or later to make feedmail work under emacs -;; 19.28." - ;; Sorry, no manual yet in this release. Look for one with the next ;; release. Or the one after that. Or maybe later. @@ -437,9 +428,7 @@ shuttled robotically onward." (defcustom feedmail-confirm-outgoing-timeout nil "If non-nil, a timeout in seconds at the send confirmation prompt. If a positive number, it's a timeout before sending. If a negative -number, it's a timeout before not sending. This will not work if your -version of Emacs doesn't include the function `y-or-n-p-with-timeout' -\(e.g., some versions of XEmacs)." +number, it's a timeout before not sending." :version "24.1" :group 'feedmail-misc :type '(choice (const nil) integer) @@ -2004,9 +1993,7 @@ backup file names and the like)." ((feedmail-fqm-p blobby) (setq blobby-buffer (generate-new-buffer (concat "FQM " blobby))) (setq already-buffer - (if (fboundp 'find-buffer-visiting) ; missing from XEmacs - (find-buffer-visiting maybe-file) - (get-file-buffer maybe-file))) + (find-buffer-visiting maybe-file)) (if (and already-buffer (buffer-modified-p already-buffer)) (save-window-excursion (display-buffer (set-buffer already-buffer)) diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el index f6fd1cd65eb..802c9ba788d 100644 --- a/lisp/mail/smtpmail.el +++ b/lisp/mail/smtpmail.el @@ -165,6 +165,13 @@ attempt." :type '(choice regexp (const :tag "None" nil)) :version "27.1") +(defcustom smtpmail-retries 10 + "The number of times smtpmail will retry sending when getting transient errors. +These are errors with a code of 4xx from the SMTP server, which +mean \"try again\"." + :type 'integer + :version "27.1") + ;; End of customizable variables. @@ -654,10 +661,12 @@ Returns an error if the server cannot be contacted." user-mail-address)))) (defun smtpmail-via-smtp (recipient smtpmail-text-buffer - &optional ask-for-password) + &optional ask-for-password + send-attempts) (unless smtpmail-smtp-server (smtpmail-query-smtp-server)) (let ((process nil) + (send-attempts (or send-attempts 1)) (host (or smtpmail-smtp-server (error "`smtpmail-smtp-server' not defined"))) (port smtpmail-smtp-service) @@ -819,6 +828,23 @@ Returns an error if the server cannot be contacted." ((smtpmail-ok-p (setq result (smtpmail-read-response process))) ;; Success. ) + ((and (numberp (car result)) + (<= 400 (car result) 499) + (< send-attempts smtpmail-retries)) + (message "Got transient error code %s when sending; retrying attempt %d..." + (car result) send-attempts) + ;; Retry on getting a transient 4xx code; see + ;; https://tools.ietf.org/html/rfc5321#section-4.2.1 + (ignore-errors + (smtpmail-send-command process "QUIT") + (smtpmail-read-response process)) + (delete-process process) + (sleep-for 1) + (setq process nil) + (throw 'done + (smtpmail-via-smtp recipient smtpmail-text-buffer + ask-for-password + (1+ send-attempts)))) ((and auth-mechanisms (not ask-for-password) (eq (car result) 530)) |