Biqqesh Timothy Luoma,
| 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 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?
Ee-yup.
# start MIDDOMAIN empty so that all ID's without @ or with nothing after
# the @ will get marked as junk as well
MIDDOMAIN=""
:0
* ^Message-Id:(_dot_)*(_at_)\/[^>]+
{ MIDDOMAIN=$MATCH }
:0
* ^From:(_dot_)*(_at_)\/[^ >,]+
{ FROMDOMAIN=$MATCH }
:0
* $ ! MIDDOMAIN ?? ^^(.*\.)?$FROMDOMAIN^^
{ whatever_you_want_to_do_if_the_ID's_domain_doesn't_end_with_that_
_of_the_sender's_address }