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 d2VsbC4uLiBhcyBpZi4uLgo=
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