Hey,

2 months later i finally got back on that topic and managed to adapt it to my configuration.

--- /etc/mail/sndrs-pgsql.conf

# PostgreSQL
conninfo host='/tmp' dbname='vmail' user='_smtpd'

query_mailaddrmap with t as (SELECT REGEXP_REPLACE( $1,'[+]([^@])+\@', '\@' )  as addr) select virtuals.email as mail from virtuals join t on REGEXP_REPLACE(virtuals.destination, '[+]([^@])+\@', '\@' ) = t.addr JOIN domains AS vd ON virtuals.email LIKE CONCAT('%',vd.domain,'%') UNION select email from credentials join t on credentials.email = t.addr;

--- EOF

Thanks !

Jarod


Le 07/01/2023 à 15:05, Tobias Fiebig a écrit :
heho,
yes, this is rather easily doable. Relevant configs from my setup below
(still want to blog about _that_ part, as my mysql is a bit more...
grown...)

General setup doc (bit outdated, though... but still explaining the
rather funny SQL statement and reasoning behind that i have in there)
here:

https://doing-stupid-things.as59645.net/mail/nsfp/2022/04/14/send-it.html


With best regards,
Tobias

--- /etc/mail/smtpd.conf
...
table sndrs mysql:/etc/mail/mysql-sndr.conf
...
listen on vio0 port 465 pki mail.aperture-labs.org smtps \
        auth <credentials> mask-src received-auth senders \
        <sndrs> filter "rspamd-sign" tag "DKIM"
listen on vio0 port 587 pki mail.aperture-labs.org tls-require \
        auth <credentials> mask-src received-auth senders \
        <sndrs> filter "rspamd-sign" tag "DKIM"
...
--- EOF

--- /etc/mail/mysql-sndr.conf

host 127.0.0.1
username opensmtpd
password
database smtpd

query_mailaddrmap with t as (SELECT REGEXP_REPLACE( ? , \
        '[+]([^@])+\@', '\@' )  as addr) select valias.addr as \
        mail from valias join t on REGEXP_REPLACE(valias.alias, \
        '[+]([^@])+\@', '\@' ) = t.addr JOIN vdomains AS vd ON \
        valias.addr LIKE CONCAT('%',vd.domain,'%') UNION select \
        mail from vusers join t on vusers.mail = t.addr;
--- EOF



Reply via email to