Gnus development mailing list
 help / color / mirror / Atom feed
From: "Patrick J. LoPresti" <patl@lcs.mit.edu>
Subject: Re: smtpmail: MAIL FROM and `gnus-posting-styles'
Date: 23 Sep 2002 15:20:45 -0400	[thread overview]
Message-ID: <s5glm5spl6a.fsf@egghead.curl.com> (raw)
In-Reply-To: <mit.lcs.mail.ding/87r8fq18bs.fsf@ID-56226.news.dfncis.de>

Micha Wiedenmann <mw-u1@gmx.de> writes:

> AFAICS it is not possible to set buffer-local variables from
> `gnus-posting-styles' but I would need buffer-local
> `user-mail-addresses' since I use several addresses.

Below is the hack I use to set user-mail-address from the From header
dynamically.  Some broken software insists on using the envelope
sender (or Sender header) for replies, so I find it pays to forge
everything if you are going to forge anything.

It should be pretty easy to adapt this code for other sending methods.
(For qmail, you may need to add "-f <user-mail-address>" to the
qmail-inject line, for instance.)

 - Pat


(defun patl-send-mail-function ()
  ;; Save and restore user-mail-address
  (let ((user-mail-address user-mail-address))
    (message-send-mail-with-sendmail)))

(setq message-send-mail-function 'patl-send-mail-function)

(add-hook 'message-send-mail-hook
          (function
           (lambda ()
             (goto-char (point-min))
             (let ((from-header (mail-header 'from (mail-header-extract)))
                   from)
               (if (stringp from-header)
                   (setq from
                         (car-safe
                          (cdr-safe
                           (mail-extract-address-components from-header)))))
               (if from
                   (setq user-mail-address from))))))



  parent reply	other threads:[~2002-09-23 19:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-17 14:37 Micha Wiedenmann
2002-09-17 17:00 ` Simon Josefsson
2002-09-17 20:47   ` Bjørn Mork
2002-09-19 14:25     ` Micha Wiedenmann
2002-09-19 17:30       ` Kai Großjohann
2002-09-21  0:42         ` Micha Wiedenmann
     [not found]       ` <mit.lcs.mail.ding/87r8fq18bs.fsf@ID-56226.news.dfncis.de>
2002-09-23 19:20         ` Patrick J. LoPresti [this message]
2002-09-24 11:44       ` Simon Josefsson
2002-09-24 16:59         ` Micha Wiedenmann
2002-09-24 20:42           ` Simon Josefsson

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=s5glm5spl6a.fsf@egghead.curl.com \
    --to=patl@lcs.mit.edu \
    /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).