David M Walker <davidw@???> probably said:
> The rule I have written is
>
> m222.*@??? $1@???
> m223.*@??? $1@???
>
> i.e. m222 as a prefix determines that the domain is datamgmt.com
> m223 as a prefix determines that the domain is venexia.com
> and so on for about another 30 domains
>
> However the rule does not appear to be matched at all (other rules
> are working)
>
> Reading TFM (It really is very good) I get the impression that
> the local part can only match on an asterisk at the begining. Is
> this the case, or is there something else wrong with what I have
> done and ultimately how do I fix it ?
(TFM quote)
] . An address containing a local part and a domain, either of which may
] start with an asterisk, implying independent wildcard matching, for
] example
]
] *@orchestra-land.fict.book
You'd seem to be correct.
In this case you can use regular expressions, instead.
] . A regular expression. This is matched against the entire address, with
] the domain part lower-cased. After matching, the numerical variables
] refer to the bracketed 'capturing' sub-expressions, with $0 referring to
] the entire address. For example, if the pattern
]
] ^(red|white).king@(wonderland|lookingglass).fict.book$
]
] is matched against the address red.king@??? then
]
] $0 = red.king@???
] $1 = red
] $2 = lookingglass
]
] Note that because the pattern part of a rewriting rule is terminated by
] white space, no white space may be present in the regular expression.
Rather than having 30 rewriting rules, I'd recommend using one rewriting
rule with regexps that uses a dbm (or similar) lookup.
(the (?i) makes the rexexp caseless).
^(?i)([^.]+)\.([^@]+)@datamgmt\.net$ \
"$2@${lookup{$1}dbm{/some/dbm/file}{$value}fail}" h
Where the dbm file contains lines like:
m222: datamgmt.com
m223: venexia.com
Completely untested, of course, but ought to help you go in that direction,
if you want to.
Oh, and you might want different rewriting flags.
P.
--
pir pir@??? pir@??? pir@???
--
*** Exim information can be found at
http://www.exim.org/ ***