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

Re: Dynamic Modification of "FROM" address automatically



At Fri, 02 Oct 2009 11:42:46 +0300,
Suresh Kumar wrote:
> 
> At Sat, 26 Sep 2009 19:32:22 +0300,
> Suresh Kumar wrote:
> > 
> > One question is, is there anyway to automatically pick up "To" and
> > convert it into "From" address when replying?
> > (I have way more addresses, don't want to end up with putting
> > templates for each address)
> 
> My Lisp skills are limited, so any help would be appreciated
> 
> Can someone throw a piece of code that does this from
> "wl-mail-setup-hook"
> 
> - read "To" address from the header
> - if this address is in "wl-user-mail-address-list", put it as "From" address
> 
So you want to reply from whatever address you received a mail to, as
long as it's one of your email addresses?

One possible solution would be a wl-draft-config-alist hack:

(setq wl-draft-config-alist
      '((reply "^To:.*me@domain1.com"
	 (template . "domain1"))
	(reply "^To:.*me@domain2.com"
	 (template . "domain2"))))

(setq wl-template-alist
      '(("domain1"
	 ("From" . "Me <me@domain1.com>"))
	("domain2"
	 ("From" . "Other Me <me@domain2.com>")
	 (wl-envelope-from . "me@domain2.com"))))

for example.

You may even be able to construct the wl-draft-config-alist
automatically from your wl-user-mail-address-list:

(defun draft-config-alist-from-user-mail-address-list ()
  (let (draft-config-alist)
    (dolist (email-address wl-user-mail-address-list (reverse draft-config-alist))
      (setq draft-config-alist
	    (cons (list 'reply (format "^To:.*%s" email-address) (cons 'template (mail-address-to-template-name email-address)))
		  draft-config-alist)))))

You'd also need an implementation of:

(defun mail-address-to-template-name (email-address))

or something other scheme to map your email addresses to template
names.
-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Richard Lewis
ISMS, Computing
Goldsmiths, University of London
Tel: +44 (0)20 7078 5134
Skype: richardjlewis
JID: ironchicken@jabber.earth.li
http://www.richard-lewis.me.uk/
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+-------------------------------------------------------+
|Please avoid sending me Word or PowerPoint attachments.|
|http://www.gnu.org/philosophy/no-word-attachments.html |
+-------------------------------------------------------+