Gnus development mailing list
 help / color / mirror / Atom feed
From: Jesper Harder <harder@myrealbox.com>
Subject: Re: [Patch] Make message-user-mail-address use From header
Date: Tue, 25 Feb 2003 04:33:36 +0100	[thread overview]
Message-ID: <m34r6t825r.fsf@defun.localdomain> (raw)
In-Reply-To: <m3isv987nt.fsf@defun.localdomain>

[-- Attachment #1: Type: text/plain, Size: 757 bytes --]

Jesper Harder <harder@myrealbox.com> writes:

> deskpot@myrealbox.com (Vasily Korytov) writes:
>
>> I was annoyed, message-user-mail-address function uses the
>> user-mail-address variable only. It may be desireable in some cases to
>> have it derived from the From header (esp, in the
>> message-send-mail-with-sendmail function).
>
> Two questions:
>
> * Why not do it in `message-make-address' instead, which appears to be
>   the function used directly in the sendmail related code?

Following up to myself:

I think it would be cleaner not to overload the meaning of
`message-*-address', but use a different function/option for the
/envelope from/ instead.  

It's only because of the envelope from you want it, right?

How about something like this?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: message.el.diff --]
[-- Type: text/x-patch, Size: 1633 bytes --]

--- gnus/lisp/message.el	Sun Feb 23 16:47:14 2003
+++ cvsgnus/lisp/message.el	Tue Feb 25 04:21:56 2003
@@ -636,6 +636,15 @@
   :group 'message-sending
   :type 'boolean)
 
+(defcustom message-sendmail-envelope-from nil
+  "*Envelope-from when sending mail with sendmail.
+If this is nil, use `user-mail-address'.  If it is the symbol
+`header', use the From: header of the message."
+  :type '(choice (string :tag "From name")
+		 (const :tag "Use From: header from message" header)
+		 (const :tag "Use `user-mail-address'" nil))
+  :group 'message-sending)
+
 ;; qmail-related stuff
 (defcustom message-qmail-inject-program "/var/qmail/bin/qmail-inject"
   "Location of the qmail-inject program."
@@ -3550,7 +3559,7 @@
 			;; But some systems are more broken with -f, so
 			;; we'll let users override this.
 			(if (null message-sendmail-f-is-evil)
-			    (list "-f" (message-make-address)))
+			    (list "-f" (message-sendmail-envelope-from)))
 			;; These mean "report errors by mail"
 			;; and "deliver in background".
 			(if (null message-interactive) '("-oem" "-odb"))
@@ -4506,6 +4515,16 @@
 	(nth 1 (mail-extract-address-components user-mail-address))
       user-mail-address)))
 
+(defun message-sendmail-envelope-from ()
+  "Return the envelope from."
+  (cond ((eq message-sendmail-envelope-from 'header)
+	 (nth 1 (mail-extract-address-components
+		 (message-fetch-field "from"))))
+	((stringp message-sendmail-envelope-from)
+	 message-sendmail-envelope-from)
+	(t
+	 (message-make-address))))
+
 (defun message-make-fqdn ()
   "Return user's fully qualified domain name."
   (let* ((system-name (system-name))

  reply	other threads:[~2003-02-25  3:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-24 21:13 Vasily Korytov
2003-02-25  1:34 ` Jesper Harder
2003-02-25  3:33   ` Jesper Harder [this message]
2003-02-25  9:11     ` Vasily Korytov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m34r6t825r.fsf@defun.localdomain \
    --to=harder@myrealbox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).