On Wed, 31 Oct 2001, Jason R. Mastaler wrote:
> BTW, here is how I'm using it to add Postfix equivalent $EXTENSION and
> $RECIPIENT variables to the environment:
>
> address_pipe:
> driver = pipe
> return_fail_output
> environment = EXTENSION=${sg{$local_part_suffix}{(^\\-|\\+)}{}}:\
> RECIPIENT=$local_part$local_part_suffix@$domain
>
> Since $local_part_suffix includes the suffix character (usually `+' or
> `-'), I had to remove it. If you end up adding additional environment
> variables, a nice one would be a representation of $local_part_suffix
> but without the leading suffix character. This is how Postfix's
> $EXTENSION and qmail's $EXT work.
I've just been looking at this for Exim 4. While it is straightforward
to add RECIPIENT, LOCAL_PART_PREFIX, and LOCAL_PART_SUFFIX (which I have
done), it it not easy to add EXTENSION, so I haven't. Exim's suffixes
are not constrained to have a single "suffix character"; the separator
can be more than one character long. However, by the time the transport
comes to be run, the only data that is available is the three parts of
the original local part. There is no record of what was the fixed part
and what was the 'wild' part of the suffix. I do not think it is worth
building the necessary apparatus, just for this purpose.
In a way I'm quite relieved, because I didn't really like the idea of
using EXTENSION, because it isn't clear if it's a prefix or a suffix.
Incidentally (1), on looking at what Sendmail does, it appears that it
doesn't put anything except TZ in the environment by default, but has a
means of configuring things. That is certainly one way of avoiding
trouble in this area. I rather wish I'd thought of it at the start!
Making such a change now seems gratuitous.
Incidentally (2), a faster way of removing the leading character of a
string would be to use ${substr rather than ${sg (but this is a minor
point).
--
Philip Hazel University of Cambridge Computing Service,
ph10@??? Cambridge, England. Phone: +44 1223 334714.