This is a placeholder for me thinking about how to discard emails based on who they are sent to.
The use case for this is very specific to me, I have a server with hundreds of unique email aliases on an old Postfix server. I want to move to Mail in a Box but I have to handle all the old email addresses, some of which I need to keep going and some I want to block.
This may be of zero interest to anybody else, but I’m interested in this, so I thought I’d log what I’m doing here so other people can use it if they see fit. I’m not expecting anybody to chip in and help, and I’m not expecting a mod to take my ideas and do anything with them
I want to block some email addresses and not others. AFAIK there is no mechanism in the web interface to MIAB to do this. This is not a criticism but an observation.
I’ve edited main.cf and changed
smtpd_recipient_restrictions=permit_sasl_authenticated,permit_mynetworks,reject_rbl_client zen.spamhaus.org,reject_unlisted_recipient,check_policy_service inet:127.0.0.1:10023
smtpd_recipient_restrictions=permit_sasl_authenticated,permit_mynetworks,reject_rbl_client zen.spamhaus.org,reject_unlisted_recipient,check_policy_service inet:127.0.0.1:10023, check_recipient_access sqlite:/etc/postfix/check_recipient_access.cf
I’ve created /etc/postfix/check_recipient_access.cf
dbpath=/home/user-data/mail/users.sqlite query = SELECT case '%s' WHEN '<<PUT AN EMAIL ADDRESS HERE>>' THEN 'DISCARD' ELSE 'OK' END;
Put a dummy email address in <> and send an e-mail to it.
tail -f /var/log/mail.log
shows that the dummy email address is DISCARDed showing that this idea might work.
So If I have a table of addresses to be blocked, I can write a SQL statement that returns DISCARD or OK for them.
This mightg work, but needs thoughts on the web interface and how to use that. Failing that a simple shell program can be used to populate the table.