Hello, I have created a Postfix content filter which is also triggered according to the mail logs, but the DISCARD action is not carried out and the mails end up in my mailbox. Does anyone have any idea why this might be? Mail-Filter: Filter: Header Filter Regexp. Pattern: <.+?(@|@.*\.)dealscomparer\.com> Action: DISCARD Mail-Log Snip: cat /var/log/mail.log | grep dealscomparer Sep 20 01:43:48 ns1 postfix/smtpd[1689133]: NOQUEUE: filter: RCPT from smtp-b-118.pro-marketing-email.de[45.129.93.118]: <[email protected]>: Sender address triggers FILTER lmtp:[127.0.0.1]:10026; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<smtp-b-118.pro-marketing-email.de> Sep 20 01:43:48 ns1 postfix/smtpd[1689133]: NOQUEUE: filter: RCPT from smtp-b-118.pro-marketing-email.de[45.129.93.118]: <[email protected]>: Sender address triggers FILTER lmtp:[127.0.0.1]:10024; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<smtp-b-118.pro-marketing-email.de> Sep 20 01:43:48 ns1 postgrey[630]: action=pass, reason=triplet found, client_name=smtp-b-118.pro-marketing-email.de, client_address=45.129.93.118/32, sender=return-a1-8097-8101-5b2e0566=3905976=8@news.dealscomparer.com, [email protected] Sep 20 01:43:48 ns1 postfix/cleanup[1697418]: 92AEE2740CB1: message-id=<[email protected]> Sep 20 01:43:48 ns1 postfix/qmgr[1728]: 92AEE2740CB1: from=<[email protected]>, size=22163, nrcpt=1 (queue active) Sep 20 01:43:54 ns1 postfix/cleanup[1697418]: DC0C12740CCC: message-id=<[email protected]> Sep 20 01:43:54 ns1 postfix/qmgr[1728]: DC0C12740CCC: from=<[email protected]>, size=22910, nrcpt=1 (queue active) Sep 20 01:43:54 ns1 amavis[1683044]: (1683044-05) Passed CLEAN {RelayedInbound}, [127.0.0.1] [45.129.93.118] <[email protected]> -> <[email protected]>, Message-ID: <[email protected]>, mail_id: uobjpH8z-dDN, Hits: 1.95, size: 22163, queued_as: DC0C12740CCC, 6288 ms Sep 20 01:43:54 ns1 dovecot: lda([email protected])<1697435><6MG7Nrr+KGOb5hkAukZkiQ>: sieve: msgid=<[email protected]>: stored mail into mailbox 'INBOX'
As far as I can see, your regex is not matched. Otherwise, it would have been discarded. The "Sender address triggers FILTER" in the log is not related to the filter you have set up.
Thank you for your answer. I just don't quite understand what's wrong with the regex. At least it matches on regex101.com with <[email protected]>. My goal is to filter all mails from "dealscomparer.com" and its subdomains. Do you have a tip for me?
Ok, i've got it. After i add slashes at begin and end of regex it works. /<.+?(@|@.*\.)dealscomparer\.com>/