so I tried this:

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

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

/^e_j...@arix.com$/ e...@arix.com

which also failed... so I'm mystified but I'm happy that now e/j...@arix.com , e.j...@arix.com and e-j...@arix.com all land in my box... curiously the address isn't actually rewritten (so I actually see the character used). also e...@arix.com and e+j...@arix.com 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 ekkis_j...@arix.com you convert it to ekkis+j...@arix.com ?

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$/ sales+$...@example.com
/^info_(.*)@example\.com$/ info+$...@example.com
/^bob_(.*)@example\.com$/ bob+$...@example.com

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