<<< Date Index >>>     <<< Thread Index >>>

Re: setting sender address dependent on received address



On Sat, Nov 25, 2006 at 02:15:44AM +0100, Michael Tatge wrote:
> * On Fri, Nov 24, 2006 Keld Jørn Simonsen (keld@xxxxxxxxxx) muttered:
> > What I want is a default From: address, and then overridden if I am
> > replying to an email sent to one of my aliases. 
> > 
> > set reverse_name=yes
> > alternates "alt1@xxxxxxxxxxx|alt2@xxxxxxxxxxx"
> > myhdr From: default@xxxxxxxxxxx
> > myhdr "From: $alternates"           
> 
> set from=default@xxxxxxxxxxx
> alternates "alt1@xxxxxxxxxxx|alt2@xxxxxxxxxxx"
> set reverse_name
> 
> Don't use my_hdr From: unless in a send-hook. One reason to avoid
> my_hdr From: is - as you noted - it overwrites reverse_name.

YES!

That worked, thanks very much!
Maybe this solution should be recorded in the FAQ.

Now my remaining problem is that for instance on this mutt list, I don't
get an indication of how I received this mail in standard mail headers.
However this is recorded on my system in a header X-Original-To: 
and such a header can be made available on other systems too.

I am then wondering how to get this info into my From: header.
I don't see ways to get it there via some hook command.
I only see that I could do it via some external program executed in some
backpling shell program. Like in mutt:

   set from=`get-original-to $this-mail default@xxxxxxxxxx`

and then get-original-to :

#!/bin/sh
orig=`grep X-Original-To: $1 | head -n 1 | cut -d ' ' -f 2`
# also take care of localhost address without "." :
localaddress=`echo $orig | grep '\\.'`
if [ "$orig" = ""  -o  "$localaddress" = ""  ] ; then 
   orig=$2;
fi
echo $orig


... But I dont see how I can get the current email passed to the shell
in the backpling string.

or is there a better way?

Best regards
keld