Using Regex with Catch-All email alias ??

Hello
I am using a Return Address with a variable code embedded.
A general catch-all will catch too much spam

So I want to set up a catch-all which only catches incoming email that begin with
the code. : “M1” up to “M99999”

( must be capital M and must start with M then numbers)

To for example these would be caught and re-directed: M45B78@example.com, M777ebsgta8@example.com

But these will be rejected:

m6ftrh@example.com , hgdthm627@example.com, 7M2345ghj@example.com

Can I set up this in VirtualMin - or can I do it by editing the POSTFIX server files directly ?

In my research I found this on a Ubuntu forum:
Regex multiple catch-all setup in postfix

Question:
I need to setup a regex catch-all function on postfix such that:
tom.(anything)@domain.com goes to tom@other.com

Answer:
Add this to your main.cf
alias_maps = regexp:/etc/postfix/aliases

Then create /etc/postfix/aliases
/^tom…*@domain.com$/ tom@other.com

But maybe VirtualMin can do this ???

Any help much appreciated :slight_smile:

Thanks.

Virtualmin does not have a feature to do that directly… You can use Webmin’s Postfix module to semi-manually do what was suggested here. Check out the “Aliases” icon in the main module view.