Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
* from, reply-to header based on to header
@ 2004-10-23  8:55 Matthias Teege
  0 siblings, 0 replies; only message in thread
From: Matthias Teege @ 2004-10-23  8:55 UTC (permalink / raw)



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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-10-23  8:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-23  8:55 from, reply-to header based on to header Matthias Teege

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).