Thanks for the reply. This is what I have in my 'virtual_users' file
verbatim. I've even kept the domain names and users the same.

# Regexp                                # User to forward to
/\d{10,}@fax.mobilepbx.net/                     asterisk (I've tried both
\d{10,} and [0-9]{10,} without success)
/\[0-9]{10,}@mobilepbx.net/                     asterisk
#/[email protected]/             asterisk (When I try a specific
number like this, this does work)
/.*@mobilepbx.net/                              mobilepbx

/.*@voipbiz.org/                                voipbiz

/.*@contessa.net/                               [email protected]


When I do a couple of tests, this is what I get.

(10 digits) (No)
postmap -q [email protected] regexp:/etc/postfix/virtual_users    
mobilepbx

(11 digits) (No)
postmap -q [email protected] regexp:/etc/postfix/virtual_users
mobilepbx

(Yes)
postmap -q [email protected] regexp:/etc/postfix/virtual_users   
mobilepbx

(Yes)
postmap -q [email protected] regexp:/etc/postfix/virtual_users
voipbiz
postmap -q [email protected] regexp:/etc/postfix/virtual_users        
voipbiz

(Yes)
postmap -q [email protected] regexp:/etc/postfix/virtual_users

[email protected]

Thanks;
Frank


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Wietse Venema
Sent: Tuesday, October 6, 2020 1:37 PM
To: Postfix users <[email protected]>
Subject: Re: Forward email based on Regexps

Frank DiGennaro:
> All;
> 
>     I've made progress with this problem. By adding virtual_alias_maps 
> = regexp:/etc/postfix/virtual_users at the bottom of main.cf and 
> adding the regexps below, and running "postmap 
> /etc/postfix/virtual_users ", the two catch-alls work fine, but the 
> "longer" matches do not and ultimately they get delivered to the catch-all
address. I'm almost there. What am I missing?
> 
> Thanks in advance;

Maybe you can show what you did. It is easy to make regexp mistakes.
Note that regexp and pcre tables are parsed in the specified order, and that
the first match wins.

You can test stuff with the postmap command.

postmap -q email-address pcre:/path/to/file

        Wietse

Reply via email to