Hello, I made some tests with filters, simple content filter in particular. These tests were ok and my filters blocks these specific emails. But I have a new problem. When somebody send an email to an alias, my filter don’t work correctly. The content filter works before Postfix expand the recipients of the alias, and the filter only sees the alias recipient. I need execute the filter after Postfix expand the alias, and apply this filter to all recipients separately. I explain me with an example.
I have this alias map: group1@mycompany user1@mycompany,user2@externalcompany I want block the emails who are send to external users, for example user2@externalcompany, if the subject is one in particular. In this example, Postfix receives the email and this is delivered to filter service. I see in the log. Sep 3 09:00:24 smail postfix/smtpd[18915]: 08925212FE: client=unknown[x.x.x.x] Sep 3 09:00:24 smail postfix/cleanup[18822]: 08925212FE: message-id=<fdaf5c$57c809a=24bd7db9de0e3738@XXX> Sep 3 09:00:24 smail postfix/qmgr[18770]: 08925212FE: from=<sender1@mycompany>, size=6716, nrcpt=1 (queue active) Sep 3 09:00:24 smail postfix/pipe[19187]: 08925212FE: to=<group1@mycompany>, relay=filter, delay=0.04, delays=0.03/0/0/0, dsn=2.0.0, status=sent (delivered via filter service) Sep 3 09:00:24 smail postfix/qmgr[18770]: 08925212FE: removed My filter don't block this email because the recipient domain is the same that my local domain. Mail continues normal flow. See the logs. Sep 3 09:00:24 smail postfix/pickup[18769]: 2788221358: uid=491 from=< sender1@mycompany > Sep 3 09:00:24 smail postfix/cleanup[18935]: 2788221358: message-id=<fdaf5c$57c809a=24bd7db9de0e3738@XXX> Sep 3 09:00:24 smail postfix/qmgr[18770]: 2788221358: from=<sender1@mycompany>, size=6826, nrcpt=1 (queue active) Sep 3 09:00:24 smail postfix/local[20376]: 2788221358: to=<group1@mycompany >, relay=local, delay=0.06, delays=0.05/0/0/0.02, dsn=2.0.0, status=sent (forwarded as 2B1B9212FE) Sep 3 09:00:24 smail postfix/qmgr[18770]: 2788221358: removed The mail is forwarded and the alias is expended. Sep 3 09:00:24 smail postfix/cleanup[18822]: 2B1B9212FE: message-id=<fdaf5c$57c809a=24bd7db9de0e3738@XXX> Sep 3 09:00:24 smail postfix/qmgr[18770]: 2B1B9212FE: from=<owner-sender1@mycompany>, size=6954, nrcpt=2 (queue active) Sep 3 09:00:24 smail postfix/local[18827]: 2B1B9212FE: to=<user1@mycompany>, relay=local, delay=0.02, delays=0.02/0/0/0, dsn=2.0.0, status=sent (delivered to command: /usr/bin/procmail -t -a "$EXTENSION" DEFAULT=$HOME/Maildir/ MAILDIR=$HOME/Maildir) Sep 3 09:00:24 smail postfix/smtp[19221]: 2B1B9212FE: to=<sender2@externalcompany>, relay=x.x.x.x[x.x.x.x]:yyy, delay=0.17, delays=0.02/0/0.13/0.02, dsn=2.0.0, status=sent (250 ok: Message 105117 accepted) Sep 3 09:00:24 smail postfix/qmgr[18770]: 2B1B9212FE: removed Thank you very much.