Robert Nicholson asked,
| I mean the Bcc: header isn't retained in the mail to me is it?
It *almost* always isn't. I think the spec is that it may be visible on a
bcc, and in fact all bcc recipients may be listed on a copy sent to any of
them, but they must not be listed on the copy delivered to any addressee on
the To: or Cc: lines. The nearly universal manner of compliance (I've never
personally seen an exception) is not to display recipients of blind carbons
at all.
But all bets are off if the To: header (or Resent-To: if there are other
Resent- headers) is missing. Then you're likely to find your own address
visible in an Apparently-To: (or Apparently-Resent-To:) line, despite its
being a blind carbon.
| What I need is to know that the mail I received was to somebody else.
There are two ways to intepret that question, and each has a different
answer:
1. Do you want to know whether the item was addressed to someone else and
NOT to you (i.e., you are getting a blind carbon)? Then
* $ ! ^TO_$LOGNAME(@patternfornamesforyoursite)?( |,|$)
usually will do the trick. It can be fooled by an address in UUCP format
or an unqualified address (for the sender's own site) that matches your
logname.
2. Do you want to know whether the item was addressed to anyone additional,
even if it also addressed to you?
That's a rather more complicated superset of #1. The ^TO and ^TO_ tokens
can match on visible Bcc: and Resent-Bcc: headers, but such things usually
are not present. So I'd say that if it meets the condition (i.e., fails
the negated regexp) above, that's a clear indication. If you get a match
on [the ".*" is intentional so that the comma can come right after a digit
or a letter of the alphabet] this:
* ^TO.*,
that's another sign.
If neither of those tests passes, try this:
* 1^1 ^TO
* $ -1^1 ^TO_$LOGNAME(@patternfornamesforyoursite)?( |,|$)
So all told we have something like this:
maxscore=9876543210 # easier to remember than 2147483647; thanks, SRvdB
# You got it without being listed, there are commas separating recipients,
# or there are more total listed recipient lines than those naming you:
:0
* $ $maxscore^0 ! ^TO_$LOGNAME(@patternfornamesforyoursite)?( |,|$)
* $ $maxscore^0 ^TO.*,
* 1^1 ^TO
* $ -1^1 ^TO_$LOGNAME(@patternfornamesforyoursite)?( |,|$)
{
I-am-not-alone routine
}
I'll admit that this could be fooled by someone who puts Robert on a single
line twice or more (To: steffi2, steffi2 for example) or who has a comma
in a comment, but it should, if anything, err on the positive side (thinking
it found other recipients when there are none) than on the negative side
(thinking there are none when there are some).