From 56e5818fd65b2c87e43a3b39fe69116c3c0c6ffb Mon Sep 17 00:00:00 2001 From: Simon Josefsson Date: Fri, 11 Oct 2002 02:27:30 +0000 Subject: [PATCH] * mail/sendmail.el (mail-envelope-from): New option `header' to use RFC 2822 From: header as the envelope address. (mail-envelope-from): New function, this should be used instead of looking at the `mail-envelope-from' variable. (sendmail-send-it): Use it. * mail/smtpmail.el (smtpmail-via-smtp): Use it. --- lisp/ChangeLog | 10 ++++++++++ lisp/mail/sendmail.el | 11 ++++++++++- lisp/mail/smtpmail.el | 3 ++- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 427a41c3d99..7aff48aa8e6 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,13 @@ +2002-10-11 Simon Josefsson + + * mail/sendmail.el (mail-envelope-from): New option `header' to + use RFC 2822 From: header as the envelope address. + (mail-envelope-from): New function, this should be used instead of + looking at the `mail-envelope-from' variable. + (sendmail-send-it): Use it. + + * mail/smtpmail.el (smtpmail-via-smtp): Use it. + 2002-10-11 Andre Spiegel * dired.el (dired-insert-directory): Fix check for indentation diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el index aefe64cc656..6be03ee439c 100644 --- a/lisp/mail/sendmail.el +++ b/lisp/mail/sendmail.el @@ -82,6 +82,7 @@ If this is nil while `mail-specify-envelope-from' is non-nil, the content of `user-mail-address' is used." :version "21.1" :type '(choice (string :tag "From-name") + (const :tag "Use From: header from message" header) (const :tag "Use `user-mail-address'" nil)) :group 'sendmail) @@ -774,6 +775,14 @@ the user from the mailer." (progn (set-buffer-modified-p nil) (delete-auto-save-file-if-necessary t)))))) + +(defun mail-envelope-from () + "Return the envelope mail address to use when sending mail. +This function uses `mail-envelope-from'." + (if (eq mail-envelope-from 'header) + (nth 1 (mail-extract-address-components + (mail-fetch-field "From"))) + mail-envelope-from)) ;; This does the real work of sending a message via sendmail. ;; It is called via the variable send-mail-function. @@ -822,7 +831,7 @@ 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 (mail-envelope-from) user-mail-address)))) (unwind-protect (save-excursion (set-buffer tembuf) diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el index 82fbfdad5ed..2837c8f1bcb 100644 --- a/lisp/mail/smtpmail.el +++ b/lisp/mail/smtpmail.el @@ -540,6 +540,7 @@ This is relative to `smtpmail-queue-dir'.") (host (or smtpmail-smtp-server (error "`smtpmail-smtp-server' not defined"))) (port smtpmail-smtp-service) + (envelope-from (mail-envelope-from)) response-code greeting process-buffer @@ -689,7 +690,7 @@ This is relative to `smtpmail-queue-dir'.") ""))) ; (smtpmail-send-command process (format "MAIL FROM:%s@%s" (user-login-name) (smtpmail-fqdn))) (smtpmail-send-command process (format "MAIL FROM: <%s>%s%s" - (or mail-envelope-from + (or envelope-from smtpmail-mail-address) size-part body-part)) -- 2.39.2