Linux – how to match a user against postfix virtual maps using regex

email-serverlinuxpostfix

I have a postfix running , which recieve normal emails abc@example.com and it also recieve emails from bounce+abc@exmaple.com.

using virtual alias maps i can do simple routing like

@example.com abc

But how to write a regex that when email is recieved from bounce, it saves the email to bounce user? but if its normal email then it saves to other account?

like this

/bounce\+.*@example.com    bounce
@example.com               abc

what would be right regex to match the bounce user?

one of the production user email address is :

bouncer+george.tawiah=motc.com@gprodwoo.com

Best Answer

Try changing your regex to this one:

/^bounce\+.*@example.com$/ bounce

Edit:

Catch all other users:

/^.*@example.com$/ other