summaryrefslogtreecommitdiff
path: root/lisp/mail/smtpmail.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/mail/smtpmail.el')
-rw-r--r--lisp/mail/smtpmail.el87
1 files changed, 43 insertions, 44 deletions
diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el
index f0aa0c6ecf5..78688d170cc 100644
--- a/lisp/mail/smtpmail.el
+++ b/lisp/mail/smtpmail.el
@@ -1068,52 +1068,51 @@ Returns an error if the server cannot be contacted."
(defun smtpmail-deduce-address-list (smtpmail-text-buffer header-start header-end)
"Get address list suitable for smtp RCPT TO: <address>."
- (unwind-protect
- (with-current-buffer smtpmail-address-buffer
- (erase-buffer)
- (let ((case-fold-search t)
- (simple-address-list "")
- this-line
- this-line-end
- addr-regexp)
- (insert-buffer-substring smtpmail-text-buffer header-start header-end)
- (goto-char (point-min))
- ;; RESENT-* fields should stop processing of regular fields.
- (save-excursion
- (setq addr-regexp
- (if (re-search-forward "^Resent-\\(To\\|Cc\\|Bcc\\):"
- header-end t)
- "^Resent-\\(To\\|Cc\\|Bcc\\):"
- "^\\(To:\\|Cc:\\|Bcc:\\)")))
-
- (while (re-search-forward addr-regexp header-end t)
- (replace-match "")
- (setq this-line (match-beginning 0))
- (forward-line 1)
- ;; get any continuation lines
- (while (and (looking-at "^[ \t]+") (< (point) header-end))
- (forward-line 1))
- (setq this-line-end (point-marker))
- (setq simple-address-list
- (concat simple-address-list " "
- (mail-strip-quoted-names (buffer-substring this-line this-line-end)))))
- (erase-buffer)
- (insert " " simple-address-list "\n")
- (subst-char-in-region (point-min) (point-max) 10 ? t) ; newline --> blank
- (subst-char-in-region (point-min) (point-max) ?, ? t) ; comma --> blank
- (subst-char-in-region (point-min) (point-max) 9 ? t) ; tab --> blank
+ (with-current-buffer smtpmail-address-buffer
+ (erase-buffer)
+ (let ((case-fold-search t)
+ (simple-address-list "")
+ this-line
+ this-line-end
+ addr-regexp)
+ (insert-buffer-substring smtpmail-text-buffer header-start header-end)
+ (goto-char (point-min))
+ ;; RESENT-* fields should stop processing of regular fields.
+ (save-excursion
+ (setq addr-regexp
+ (if (re-search-forward "^Resent-\\(To\\|Cc\\|Bcc\\):"
+ header-end t)
+ "^Resent-\\(To\\|Cc\\|Bcc\\):"
+ "^\\(To:\\|Cc:\\|Bcc:\\)")))
+
+ (while (re-search-forward addr-regexp header-end t)
+ (replace-match "")
+ (setq this-line (match-beginning 0))
+ (forward-line 1)
+ ;; get any continuation lines
+ (while (and (looking-at "^[ \t]+") (< (point) header-end))
+ (forward-line 1))
+ (setq this-line-end (point-marker))
+ (setq simple-address-list
+ (concat simple-address-list " "
+ (mail-strip-quoted-names (buffer-substring this-line this-line-end)))))
+ (erase-buffer)
+ (insert " " simple-address-list "\n")
+ (subst-char-in-region (point-min) (point-max) 10 ? t) ; newline --> blank
+ (subst-char-in-region (point-min) (point-max) ?, ? t) ; comma --> blank
+ (subst-char-in-region (point-min) (point-max) 9 ? t) ; tab --> blank
- (goto-char (point-min))
- ;; tidiness in case hook is not robust when it looks at this
- (while (re-search-forward "[ \t]+" header-end t) (replace-match " "))
+ (goto-char (point-min))
+ ;; tidiness in case hook is not robust when it looks at this
+ (while (re-search-forward "[ \t]+" header-end t) (replace-match " "))
- (goto-char (point-min))
- (let (recipient-address-list)
- (while (re-search-forward " \\([^ ]+\\) " (point-max) t)
- (backward-char 1)
- (setq recipient-address-list (cons (buffer-substring (match-beginning 1) (match-end 1))
- recipient-address-list)))
- (setq smtpmail-recipient-address-list recipient-address-list))))))
+ (goto-char (point-min))
+ (let (recipient-address-list)
+ (while (re-search-forward " \\([^ ]+\\) " (point-max) t)
+ (backward-char 1)
+ (setq recipient-address-list (cons (buffer-substring (match-beginning 1) (match-end 1))
+ recipient-address-list)))
+ (setq smtpmail-recipient-address-list recipient-address-list)))))
(defun smtpmail-do-bcc (header-end)
"Delete [Resent-]Bcc: and their continuation lines from the header area.