so I tried this:

/^([^._\/-]*)[._\/-](.*)@arix\.com$/ ${1}[email protected]

which seemed to work fine, except for the underscores. thinking that they might be meaningful to the set declaration I tried:

/^[email protected]$/ [email protected]

which also failed... so I'm mystified but I'm happy that now e/[email protected] , [email protected] and [email protected] all land in my box... curiously the address isn't actually rewritten (so I actually see the character used). also [email protected] and [email protected] still work.

any light on the underscore would be cool.

On Sep 25, 2009, at 10:10 PM, LuKreme wrote:

On 25-Sep-2009, at 19:49, Erick Calder wrote:
do I understand it correctly that when a message arrives with an address like [email protected] you convert it to [email protected] ?

Exactly.

if so, would you share your pcre? this I would really like to do because a lot of sites don't allow + in the address

Which is exactly why I did it.

The virtual_sql.pcre file is basically this:

/^sales_(.*)@example\.com$/ [email protected]
/^info_(.*)@example\.com$/ [email protected]
/^bob_(.*)@example\.com$/ [email protected]

I have one line for every email address

The SQL one is the same, but is for all the sql stored users. I thought about making this a lookup, but I don't have enough users to make it worthwhile, and building the list is pretty fast.

ls -1 /usr/local/virtual/ | grep "@" | \
sed 's/^\([...@]*\)@\([^.]*\)\.\(.*\)$/\/^\1_\(.*\)@\2\\.\3$\/ \1+${1}@ \2.\3/' > \
/etc/postfix/virtual_address.pcre

I'd suggest reading the thread "Re: address rewriting with pcre?" from March of this year since Wietse referred to my method as 'unsafe'.

What I have works for me and I have few enough addresses that I can easily spot any problems. (for example, no email addresses on my system have odd characters that need escaping in the username portion, and no domains have multiple .'s)


--
The Salvation Army Band played and the children drunk
        lemonade and the morning lasted all day, all day.
        And through an open window came like Sinatra in a
        younger day pushing the town away


Reply via email to