Commit 821de968 authored by Stefan Monnier's avatar Stefan Monnier

(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.
parent 8bea7e9a
Pipeline #4228 failed with stage
in 56 minutes and 59 seconds
...@@ -854,18 +854,24 @@ Doing so would be even more evil than leaving it out." ...@@ -854,18 +854,24 @@ Doing so would be even more evil than leaving it out."
:type 'boolean) :type 'boolean)
(defcustom message-sendmail-envelope-from (defcustom message-sendmail-envelope-from
;; `mail-envelope-from' is unavailable unless sendmail.el is loaded. 'obey-mail-envelope-from
(if (boundp 'mail-envelope-from) mail-envelope-from)
"Envelope-from when sending mail with sendmail. "Envelope-from when sending mail with sendmail.
If this is nil, use `user-mail-address'. If it is the symbol If this is nil, use `user-mail-address'. If it is the symbol
`header', use the From: header of the message." `header', use the From: header of the message."
:version "23.2" :version "27.1"
:type '(choice (string :tag "From name") :type '(choice (string :tag "From name")
(const :tag "Use From: header from message" header) (const :tag "Use From: header from message" header)
(const :tag "Obey `sendmail-envelope-from'"
obey-mail-envelope-from)
(const :tag "Use `user-mail-address'" nil)) (const :tag "Use `user-mail-address'" nil))
:link '(custom-manual "(message)Mail Variables") :link '(custom-manual "(message)Mail Variables")
:group 'message-sending) :group 'message-sending)
(defun message--sendmail-envelope-from ()
(if (eq message-sendmail-envelope-from 'obey-mail-envelope-from)
(if (boundp 'mail-envelope-from) mail-envelope-from)
message-sendmail-envelope-from))
(defcustom message-sendmail-extra-arguments nil (defcustom message-sendmail-extra-arguments nil
"Additional arguments to `sendmail-program'." "Additional arguments to `sendmail-program'."
;; E.g. '("-a" "account") for msmtp ;; E.g. '("-a" "account") for msmtp
...@@ -5884,11 +5890,11 @@ give as trustworthy answer as possible." ...@@ -5884,11 +5890,11 @@ give as trustworthy answer as possible."
(defun message-sendmail-envelope-from () (defun message-sendmail-envelope-from ()
"Return the envelope from." "Return the envelope from."
(cond ((eq message-sendmail-envelope-from 'header) (cond ((eq (message--sendmail-envelope-from) 'header)
(nth 1 (mail-extract-address-components (nth 1 (mail-extract-address-components
(message-fetch-field "from")))) (message-fetch-field "from"))))
((stringp message-sendmail-envelope-from) ((stringp (message--sendmail-envelope-from))
message-sendmail-envelope-from) (message--sendmail-envelope-from))
(t (t
(message-make-address)))) (message-make-address))))
......
...@@ -239,8 +239,8 @@ Prompts for bug subject. Leaves you in a mail buffer." ...@@ -239,8 +239,8 @@ Prompts for bug subject. Leaves you in a mail buffer."
;; Stop message-mode stealing the properties we will add. ;; Stop message-mode stealing the properties we will add.
(set (make-local-variable 'message-strip-special-text-properties) nil) (set (make-local-variable 'message-strip-special-text-properties) nil)
;; Make sure we default to the From: address as envelope when sending ;; Make sure we default to the From: address as envelope when sending
;; through sendmail. ;; through sendmail. FIXME: Why?
(when (and (not message-sendmail-envelope-from) (when (and (not (message--sendmail-envelope-from))
(message-bogus-recipient-p (message-make-address))) (message-bogus-recipient-p (message-make-address)))
(set (make-local-variable 'message-sendmail-envelope-from) 'header))) (set (make-local-variable 'message-sendmail-envelope-from) 'header)))
(rfc822-goto-eoh) (rfc822-goto-eoh)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment