I'm trying to do some spam-fighting against certain domains.
One of the things I would like to do is check for From: lines whose domain
name does not match the message ID.
[ Note: because of the guarantee of mismatches for this recipe, these
messages would simply be sent to another mailbox, not bounced. ]
I am having trouble figuring out how to get just the domain name, and not
the hostname.domain.name.
Such as
:0
* ^From:(_dot_)*(_at_)aol\(_dot_)com
* ! ^Message-ID:(_dot_)*(_at_)aol\(_dot_)com
will always fail because the message ID always has a longer hostname than
just the domain name.
I know I could do this:
:0
* ^From:(_dot_)*(_at_)aol\(_dot_)com
* ! ^Message-ID:(_dot_)*(_at_)(_dot_)*\(_dot_)aol\(_dot_)com
but that means hard-coding a check for each domain, where I would like to be
able to do something like this:
# get the domain listed in the message-id
MIDDOMAIN=`formail -zxMessage-ID: | sed 's/.*@//g' |tr -d '>'`
# get the domain listed in the From line
FROMDOMAIN=`formail -zxFrom: | sed 's/.*@//g' |tr -d '>'`
Now this works as long as they are the same, but will not if there is a
hostname difference in the same domain.
Suggestions?
TjL