Re: [Exim] environment vars & extension addresses

Top Page
Delete this message
Reply to this message
Author: Philip Hazel
Date:  
To: Jason R. Mastaler
CC: exim-users
Subject: Re: [Exim] environment vars & extension addresses
On Wed, 31 Oct 2001, Jason R. Mastaler wrote:

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


Oh, sorry. I wasn't thinking. Of course. Conventional .forward files are
not expanded. Damn.

The easiest way to work round this is to enable filtering (set "filter"
on your forwardfile director), and change your .forward file to

#Exim filter
pipe "/home/johndoe/envwrite $sender_address $local_part $local_part_suffix"

In filter files, everything is 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.


Come to think of it, YES! There is an "environment" option for the pipe
transport. You can add anything you like to it. Why had I forgotten that
simple answer? Check it out in TFM.

> 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


Good point. Neither were released when I first started Exim.

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


I'm always open-minded!

Philip

-- 
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.