aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2019-12-03 15:38:48 -0500
committerStefan Monnier2019-12-03 15:38:48 -0500
commit821de968434d2096bdea67dd24301bf6b517aef1 (patch)
tree7569a3b8d437a285ed4038d1165093eed8a69103
parent8bea7e9ab4453da71d9766d582089154f31de907 (diff)
downloademacs-821de968434d2096bdea67dd24301bf6b517aef1.tar.gz
emacs-821de968434d2096bdea67dd24301bf6b517aef1.zip
(message-sendmail-envelope-from): Obey `mail-envelope-from` even if set later
* lisp/gnus/message.el (message-sendmail-envelope-from): Change default. (message--sendmail-envelope-from): New function. (message-sendmail-envelope-from): Use it. * lisp/mail/emacsbug.el (report-emacs-bug): Use it.
-rw-r--r--lisp/gnus/message.el18
-rw-r--r--lisp/mail/emacsbug.el4
2 files changed, 14 insertions, 8 deletions
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index f33454e7047..e60ea4f0e85 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -854,18 +854,24 @@ Doing so would be even more evil than leaving it out."
854 :type 'boolean) 854 :type 'boolean)
855 855
856(defcustom message-sendmail-envelope-from 856(defcustom message-sendmail-envelope-from
857 ;; `mail-envelope-from' is unavailable unless sendmail.el is loaded. 857 'obey-mail-envelope-from
858 (if (boundp 'mail-envelope-from) mail-envelope-from)
859 "Envelope-from when sending mail with sendmail. 858 "Envelope-from when sending mail with sendmail.
860If this is nil, use `user-mail-address'. If it is the symbol 859If this is nil, use `user-mail-address'. If it is the symbol
861`header', use the From: header of the message." 860`header', use the From: header of the message."
862 :version "23.2" 861 :version "27.1"
863 :type '(choice (string :tag "From name") 862 :type '(choice (string :tag "From name")
864 (const :tag "Use From: header from message" header) 863 (const :tag "Use From: header from message" header)
864 (const :tag "Obey `sendmail-envelope-from'"
865 obey-mail-envelope-from)
865 (const :tag "Use `user-mail-address'" nil)) 866 (const :tag "Use `user-mail-address'" nil))
866 :link '(custom-manual "(message)Mail Variables") 867 :link '(custom-manual "(message)Mail Variables")
867 :group 'message-sending) 868 :group 'message-sending)
868 869
870(defun message--sendmail-envelope-from ()
871 (if (eq message-sendmail-envelope-from 'obey-mail-envelope-from)
872 (if (boundp 'mail-envelope-from) mail-envelope-from)
873 message-sendmail-envelope-from))
874
869(defcustom message-sendmail-extra-arguments nil 875(defcustom message-sendmail-extra-arguments nil
870 "Additional arguments to `sendmail-program'." 876 "Additional arguments to `sendmail-program'."
871 ;; E.g. '("-a" "account") for msmtp 877 ;; E.g. '("-a" "account") for msmtp
@@ -5884,11 +5890,11 @@ give as trustworthy answer as possible."
5884 5890
5885(defun message-sendmail-envelope-from () 5891(defun message-sendmail-envelope-from ()
5886 "Return the envelope from." 5892 "Return the envelope from."
5887 (cond ((eq message-sendmail-envelope-from 'header) 5893 (cond ((eq (message--sendmail-envelope-from) 'header)
5888 (nth 1 (mail-extract-address-components 5894 (nth 1 (mail-extract-address-components
5889 (message-fetch-field "from")))) 5895 (message-fetch-field "from"))))
5890 ((stringp message-sendmail-envelope-from) 5896 ((stringp (message--sendmail-envelope-from))
5891 message-sendmail-envelope-from) 5897 (message--sendmail-envelope-from))
5892 (t 5898 (t
5893 (message-make-address)))) 5899 (message-make-address))))
5894 5900
diff --git a/lisp/mail/emacsbug.el b/lisp/mail/emacsbug.el
index 1c2f11680b6..fea7619b505 100644
--- a/lisp/mail/emacsbug.el
+++ b/lisp/mail/emacsbug.el
@@ -239,8 +239,8 @@ Prompts for bug subject. Leaves you in a mail buffer."
239 ;; Stop message-mode stealing the properties we will add. 239 ;; Stop message-mode stealing the properties we will add.
240 (set (make-local-variable 'message-strip-special-text-properties) nil) 240 (set (make-local-variable 'message-strip-special-text-properties) nil)
241 ;; Make sure we default to the From: address as envelope when sending 241 ;; Make sure we default to the From: address as envelope when sending
242 ;; through sendmail. 242 ;; through sendmail. FIXME: Why?
243 (when (and (not message-sendmail-envelope-from) 243 (when (and (not (message--sendmail-envelope-from))
244 (message-bogus-recipient-p (message-make-address))) 244 (message-bogus-recipient-p (message-make-address)))
245 (set (make-local-variable 'message-sendmail-envelope-from) 'header))) 245 (set (make-local-variable 'message-sendmail-envelope-from) 'header)))
246 (rfc822-goto-eoh) 246 (rfc822-goto-eoh)