summaryrefslogtreecommitdiff
path: root/lisp/mail/sendmail.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2021-05-06 12:21:11 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2021-05-06 12:21:11 +0200
commitb69e2699aaae6c13a14d8904b0b21e519c770336 (patch)
tree7e76d777639de43b47904591a72639929baa0765 /lisp/mail/sendmail.el
parentc8c27864aa5db2604304a6354ae441c7b0ca5474 (diff)
downloademacs-b69e2699aaae6c13a14d8904b0b21e519c770336.tar.gz
Only look at the headers when computing the envelope from address
* lisp/mail/smtpmail.el (smtpmail-send-it) (smtpmail-send-queued-mail, smtpmail-via-smtp): * lisp/mail/sendmail.el (sendmail-send-it): Only look at the headers when computing the envelope from (bug#47616).
Diffstat (limited to 'lisp/mail/sendmail.el')
-rw-r--r--lisp/mail/sendmail.el8
1 files changed, 7 insertions, 1 deletions
diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el
index cd071667562..9a4c8f3c665 100644
--- a/lisp/mail/sendmail.el
+++ b/lisp/mail/sendmail.el
@@ -30,6 +30,7 @@
(require 'mail-utils)
(require 'rfc2047)
(autoload 'message-make-date "message")
+(autoload 'message-narrow-to-headers "message")
(defgroup sendmail nil
"Mail sending commands for Emacs."
@@ -1177,7 +1178,12 @@ external program defined by `sendmail-program'."
;; local binding in the mail buffer will take effect.
(envelope-from
(and mail-specify-envelope-from
- (or (mail-envelope-from) user-mail-address))))
+ (or (save-restriction
+ ;; Only look at the headers when fetching the
+ ;; envelope address.
+ (message-narrow-to-headers)
+ (mail-envelope-from))
+ user-mail-address))))
(unwind-protect
(with-current-buffer tembuf
(erase-buffer)