I have setup up a basic email server using PostFix with Dovecot/IMAP. But i face some issue with the blacklist setup.
below is my postfix main.cf
smtpd_recipient_restrictions = check_sender_access mysql:/etc/postfix/blacklist.cf reject_unauth_destination
user = mailuser password = mailuser2011 hosts = 127.0.0.1 dbname = mailserver query = SELECT 'REJECT' FROM blacklist WHERE email='%s' AND id=( SELECT id FROM virtual_users WHERE email='%u')
My SQL table have 2 columns for the blacklist. Namely the
id and the
What I want to do is to retrieve the address match from the database with reference to the recipient in the mail. If I hard code the email value to something existing in the database it will be able to reject mails from the blocked user.
However, if I uses the
%u(which I assume it refers to the recipient), it fails to block at all.