On 12/08/2019 12:32, mabi wrote:
Hello,
I would like to add an extra table in a PostgreSQL database to define domain
names which I will reject mails from (mostly spam domains) on my OpenBSD 6.5 MX
server.
For that I would need to add the following query_mailaddr to my
/etc/mail/postgresql.conf file as documented here
(https://github.com/OpenSMTPD/OpenSMTPD-extras/pull/54):
query_mailaddr SELECT address FROM rejects WHERE address=?
The problem is that I already have a query_mailaddr entry in that file which is
the following:
query_mailaddr SELECT destination FROM vusers WHERE email =
REGEXP_REPLACE($1,'(.*)\+[\w-]+@(.*)','\1@\2');
and which I need in order to define my valid recipients using the following
table/match rule:
table recipients postgres:/etc/mail/postgresql.conf
match from any for domain <domains> rcpt-to <recipients> action "relay_amavis"
so, when I start smtpd I get the following error:
domains[19067]: warn: duplicate key query_mailaddr
domains[19067]: fatal: error parsing config file
Does anyone know how I can still achieve that? Maybe with another type of
"query_" but which one?
Best regards,
Mabi
Whilst I have no experience with the new OpenSMTPD, I have my 6.0.3
working with MySQL and 2 separate query_mailaddr (recipients and
blacklist). I solved it by simply putting the blacklist query_mailaddr
in a separate config file.
table recipients mysql:/etc/opensmtpd/mysql.conf
table blacklist mysql:/etc/opensmtpd/mysql-blacklist.conf
Good luck,
Reio