On Tue, Mar 17, 2009 at 03:52:27PM CET, Victor Duchovni 
<victor.ducho...@morganstanley.com> said:
> On Tue, Mar 17, 2009 at 10:01:53AM -0400, Charles Marcus wrote:
> 
> > On 3/17/2009 9:43 AM, Erwan David wrote:
> > > You may generate the pcre file with a line
> > > /recipient_([...@_]+)@localdomain/    recipient+$...@localdomain
> > > 
> > > for each valid recipient. This would preserve the validation of
> > > recipient at RCPT TO stage.
> > 
> > Interesting... and maybe a good candidate for my first usable scripting
> > attempt.
> 
> Perl is the natural choice for this:
> 
>     $ echo u...@example.com |
>       domain=example.com perl -lpe '
>           s{^(.*)\...@\q$env{domain}\e$}
>               {/^\Q$1\E_(.*)\...@\q$env{domain}\e\$/ 
> $1+\${...@$env{domain}}o;'
>     /^user_(.*)@example\.com$/ user+$...@example.com
> 
> In practice instead of "echo ... |" Perl would read a list of addresses from
> a file. The "\Q...\E" construct is the critical ingredient for quoting PCRE
> special characters in the address localpart and domain.

I would have used ruby, but it is equivalent modulo your knowledge of
either language.

-- 
Erwan

Reply via email to