Re: [Exim] environment vars & extension addresses

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Frank S. Bernhardt
Ημερομηνία:  
Προς: Jason R. Mastaler
Υ/ο: exim-users
Αντικείμενο: Re: [Exim] environment vars & extension addresses
I'm not too up on bash or how envwrite works but maybe you need to echo the variables, something like:

/home/johndoe/envwrite 'echo $sender_address' 'echo $local_part' 'echo $local_part_suffix'



"Jason R. Mastaler" wrote:

> Philip Hazel <ph10@???> writes:
>
> > Exim doesn't put all of this information in the environment, but the
> > information is available in Exim variables which you can pass over
> > to your script as arguments. For example, in the .forward file you
> > could have
> >
> > |/name/of/script $sender_address $local_part $local_part_suffix
> >
> > and the information you require will be put in the first three
> > arguments that are passed to the script.
>
> Do I have to add something to my Exim config to get those variables
> expanded in the .forward? It doesn't seem to work for me.
>
> To test, my .forward contains:
> |/home/johndoe/envwrite $sender_address $local_part $local_part_suffix
>
> /home/johndoe/envwrite contains:
> #!/usr/local/bin/bash
> echo $* > ~/env
>
> After sending a message to johndoe, /home/johndoe/env contains:
> $sender_address $local_part $local_part_suffix
>
> So the arguments are passed in literally, not expanded.
>
> Also, is there a way to set environment variables in the .forward
> before invoking the pipe command? Something analogous to:
>
> SENDER="$sender_address"
> RECIPIENT="$local_part@$domain"
> EXTENSION="$local_part_suffix"
> |/name/of/script
>
> This way I wouldn't have to modify my program at all.
>
> > I think I'd like to keep the environment small, because otherwise
> > the requirement to put more and more information in it is very
> > open-ended.
>
> I understand. You might at least want to look over what Postfix and
> qmail put in the environment for reference.
>
> Postfix: http://www.postfix.org/local.8.html
> qmail: http://www.qmail.org/man/man8/qmail-command.html
>
> > However, I can see a case for LOCAL_PART_PREFIX and
> > LOCAL_PART_SUFFIX so that the entire recipient address is available
> > by that means.
>
> Great, thanks for being open-minded about this. I also think
> RECIPIENT (envelope recipient address, local@domain) would be a
> worthwhile addition so those needing that information wouldn't have to
> concatenate $LOCAL_PART and $DOMAIN to get it.
>
> --
>
> ## List details at http://www.exim.org/mailman/listinfo/exim-users Exim details at http://www.exim.org/ ##


--

Regards

Frank S. Bernhardt
b.c.s.i.
14 Halton Court
Markham, ON.
L3P 6R3

905-471-1691 Voice
905-471-3016 FAX

frank@???