On 3/19/2009 5:55 AM, LuKreme 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.

Or... not...

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

Whew... as a non-programmer, lets just say I almost swallowed my adams
apple when I saw Victors perl magic... ;)

> I came up with this one liner:
> 
>  $ ls -1 /usr/local/virtual/ | grep "@" | sed
> 's/^\([...@]*\)@\(.*\)$/\/^\1_\(.*\)@\2$\/ \1+$...@\2/'
> 
> testu...@example.com => /^testuser_(.*)@example.com$/
> testuser+$...@example.com
> 
> But the sed works for dumping all the virtual users into a .pcre map for
> postfix.

I guess I'll just have to wait and see if this ever gets support
natively... it isn't that big of a problem, but it is very annoying when
I run into a site that doesn't allow using a plussed address, and having
an optional character or two that I could designate on a per site basis
would be very convenient.

Reply via email to