virtual_alias_maps with both: regexp and mysql

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

virtual_alias_maps with both: regexp and mysql

Frank Walter
Hallo

I wonder if I could add a regexp rule to my virtual_alias_maps so I could realize wildcard addresses, like:

[hidden email] > [hidden email]

At the moment I have:

virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf,mysql:/etc/postfix/mysql-email2email.cf

and with RegEx I would write:

virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf,mysql:/etc/postfix/mysql-email2email.cf,regexp:/etc/postfix/aliases_regex.cf

as I can read in:

https://superuser.com/questions/353488/regex-multiple-catch-all-setup-in-postfix

In: /etc/postfix/aliases_regex.cf

I would put then:

/^.*@mydomain.tld$/     [hidden email]

Would that be correct?
I don’t want to just test it, it is a productive mailserver.

Thanks, frank



My postfix config files:

/etc/postfix/mysql-virtual-alias-maps.cf

user = myuser
password = mypassword
hosts = 127.0.0.1
dbname = mymailserverdb
query = SELECT destination FROM view_aliases WHERE email='%s'


/etc/postfix/mysql-email2email.cf

user = myuser
password = mypassword
hosts = 127.0.0.1
dbname = mymailserverdb
query = SELECT email FROM view_users WHERE email='%s'

Postfix Version: 3.3.0-1ubuntu0.3 on Ubuntu 18.04.05 LTS


Reply | Threaded
Open this post in threaded view
|

Re: virtual_alias_maps with both: regexp and mysql

Leonardo Rodrigues Magalhães
Em 09/01/2021 06:25, Frank Röhm escreveu:
> I would put then:
>
> /^.*@mydomain.tld$/     [hidden email]
>
> Would that be correct?
> I don’t want to just test it, it is a productive mailserver.
>
>

     Never actually tried it, bur first thing that cames to my mind is
"why not let MySQL solve the regexp itself, instead of postfix"?

https://dev.mysql.com/doc/refman/8.0/en/regexp.html


--


        Atenciosamente / Sincerily,
        Leonardo Rodrigues
        Solutti Tecnologia
        http://www.solutti.com.br

        Minha armadilha de SPAM, NÃO mandem email
        [hidden email]
        My SPAMTRAP, do not email it



Reply | Threaded
Open this post in threaded view
|

Re: virtual_alias_maps with both: regexp and mysql

Frank Walter

> Am 09.01.2021 um 13:25 schrieb Leonardo Rodrigues <[hidden email]>:
>
> Em 09/01/2021 06:25, Frank Röhm escreveu:
>> I would put then:
>>
>> /^.*@mydomain.tld$/     [hidden email]
>>
>> Would that be correct?
>> I don’t want to just test it, it is a productive mailserver.
>>
>>
>
>     Never actually tried it, bur first thing that cames to my mind is "why not let MySQL solve the regexp itself, instead of postfix"?
>
> https://dev.mysql.com/doc/refman/8.0/en/regexp.html
>

What is the advantage?
And how would be my setting then?
Another table?