From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/50370 Path: main.gmane.org!not-for-mail From: Jesper Harder Newsgroups: gmane.emacs.gnus.general Subject: Re: [Patch] Make message-user-mail-address use From header Date: Tue, 25 Feb 2003 04:33:36 +0100 Organization: http://purl.org/harder/ Sender: owner-ding@hpc.uh.edu Message-ID: References: <87of51xtyo.fsf@unix.home> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: main.gmane.org 1046144695 5255 80.91.224.249 (25 Feb 2003 03:44:55 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 25 Feb 2003 03:44:55 +0000 (UTC) Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18nW1V-0001MQ-00 for ; Tue, 25 Feb 2003 04:44:53 +0100 Original-Received: from sina.hpc.uh.edu ([129.7.128.10] ident=lists) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 18nW0m-00088H-00; Mon, 24 Feb 2003 21:44:08 -0600 Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Mon, 24 Feb 2003 21:45:06 -0600 (CST) Original-Received: from sclp3.sclp.com (sclp3.sclp.com [66.230.238.2]) by sina.hpc.uh.edu (8.9.3/8.9.3) with SMTP id VAA08249 for ; Mon, 24 Feb 2003 21:44:53 -0600 (CST) Original-Received: (qmail 36581 invoked by alias); 25 Feb 2003 03:43:50 -0000 Original-Received: (qmail 36576 invoked from network); 25 Feb 2003 03:43:50 -0000 Original-Received: from quimby.gnus.org (80.91.224.244) by 66.230.238.6 with SMTP; 25 Feb 2003 03:43:50 -0000 Original-Received: from news by quimby.gnus.org with local (Exim 3.12 #1 (Debian)) id 18nWG1-0004xc-00 for ; Tue, 25 Feb 2003 04:59:53 +0100 Original-To: ding@gnus.org Original-Path: localhost.localdomain!nobody Original-Newsgroups: gnus.ding Original-Lines: 77 Original-NNTP-Posting-Host: 0xc3f95307.esnxr2.ras.tele.dk Original-X-Trace: quimby.gnus.org 1046145593 19071 195.249.83.7 (25 Feb 2003 03:59:53 GMT) Original-X-Complaints-To: usenet@quimby.gnus.org Original-NNTP-Posting-Date: 25 Feb 2003 03:59:53 GMT X-Face: ^RrvqCr7c,P$zTR:QED"@h9+BTm-"fjZJJ-3=OU7.)i/K]<.J88}s>'Z_$r; 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? --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=message.el.diff --- 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)) --=-=-=--