The Computer Oracle

Regex multiple catch-all setup in postfix

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game 5 Looping

--

Chapters
00:00 Regex Multiple Catch-All Setup In Postfix
00:22 Accepted Answer Score 18
00:43 Answer 2 Score 4
00:58 Thank you

--

Full question
https://superuser.com/questions/353488/r...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#ubuntu #postfix

#avk47



ACCEPTED ANSWER

Score 18


Add this to your main.cf:

alias_maps = regexp:/etc/postfix/aliases

Then create /etc/postfix/aliases as follows:

/^tom\..*@domain.com$/     tom@other.com
/^phil\..*@domain.com$/    phil@other.com

See the regexp table documentation for additional information.




ANSWER 2

Score 4


I'll add this for people who are wondering if it is possible to handle multiple address aliases with less configuration:

/^(.*)\..*@domain.com$/     $1@other.com

This will forward:

<anything>.<part_b>@domain.com

to

<anything>@other.com