neg. lookahead not working for postfix header

ph flag

I'm trying to exclude all emails not received from a mainstream domain The full postfix regex in /etc/postfix/header_checks is: /Received:(?!.*\.((net|com|edu|gov|org|info)))/m DISCARD

Bu the negative lookahead is failing to match longer header strings. These longer header strings are seen in emails that are automatically forwarded from a gmail account (in the example below, forwarded from [email protected] to [email protected]):

Received: by 2002:a05:651c:98a:: with SMTP id b10mr2387341ljq.280.1630748063910;?        Sat, 04 Sep 2021 02:34:23 -0700 (PDT) from[]; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<>

is it something to do with the ;? part of the string? I have no idea why its failing thanks MD

anx avatar
fr flag
You mean to tell me you wish to silently disappear any mail that at some point was ever relayed by any host not spelling out its FQDN containing one of those TLDs? That sounds.. less like a reasonable practice and more like the result of a misunderstanding. What problem are you *actually* attempting to solve?
Michael Sandy avatar
ph flag
Re '...disappear ...any host not spelling out ...TLDs'? Well, yes, after an analysis of my mail header information. Cant cope with the spam despite max lookup services and a heap of regex already. Same email address in use 17 years now...has obviously been put around.
Michael Hampton avatar
cz flag
It looks like the regex is doing what you want. The string contains com, so it should fail to match.

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.