info-gnus-english
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

from, reply-to header based on to header


From: Matthias Teege
Subject: from, reply-to header based on to header
Date: Sat, 23 Oct 2004 10:55:51 +0200
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (berkeley-unix)

Moin,

I try to set the from and reply-to header based on the to header
of an email. Something like this:

(setq mtg-gnus-map-address 
      '(("foo@empfaenger.domain" . 
         (("from" . "me-from@meine.domain")
          ("reply-to" . "me-replyto@meine.domain")))
        ("bar@another.domain" . 
         (("from" . "me-fromanother@meine.domain")
          ("reply-to" . "me-replytox@meine.domain")))))

(defun mtg-gnus-send-hook (&optional foo)
  "doc"
  (interactive "P")
  (let ((to (save-excursion
              (when (and (boundp 'gnus-message-buffer)
                         (gnus-buffer-live-p gnus-message-buffer))
                (set-buffer gnus-message-buffer)
                (message-fetch-field "to")))))
    (cdr 
     (assoc foo 
            (assoc (cadr (gnus-extract-address-components to)) 
mtg-gnus-map-address)))))

(setq current-reply-to (mtg-gnus-send-hook "reply-to"))
(setq current-from (mtg-gnus-send-hook "from"))

This works but how do I connect the function to gnus? Is there a
better solution?

Matthias
-- 
Matthias Teege -- http://www.mteege.de
make world not war


reply via email to

[Prev in Thread] Current Thread [Next in Thread]