On Thu, 27 Mar 2014, Marcin Mirosław wrote:

W dniu 24.02.2014 16:24, John Hardin pisze:
On Mon, 24 Feb 2014, Marcin Mirosław wrote:

Sorry for silly question. I'd like to know if mentioned rules catches
all email address or only user part?

It's not a silly question. All of the TO_EQ_FROM rules compare the full
email address.

In theory I could it by self, it's only one line of code:) But I'm not
so good in regexp to do it.

These rules compare the All pseudo-header since we want to check whether two different headers contain the same value.

One is for the case where the From: header precedes the To: header. This is the simpler case. It matches and captures the email address that appears in the From: header. (Note that the ":addr" option isn't available for the All pseudo-header so we need to pick out the address part explicitly.) We then look for the captured string in the To: header.

The other is for the reverse, where the To: header precedes the From: header. Since the To: header can contain multiple addresses, this one is less optimal, but it essentially does the same thing: matches and captures the (first) email address in the To: header and looks for that string in the From: header.

One possible improvement would be to add a third version that gets the envelope recipient address in a Received: header, similar to what __SUBJ_HAS_TO_2 does, and checks for that in the From: header. I will probably add that shortly.

If you wanted to compare parts of the address you'd have to modify the part that matches the address; for example to match just the username part you'd change the capture expression from ([^\n\s>]+) to ([^\s\n>\@]+) and the match expression from \1[>,\s\n] to \1[\@]

--
 John Hardin KA7OHZ                    http://www.impsec.org/~jhardin/
 jhar...@impsec.org    FALaholic #11174     pgpk -a jhar...@impsec.org
 key: 0xB8732E79 -- 2D8C 34F4 6411 F507 136C  AF76 D822 E6E6 B873 2E79
-----------------------------------------------------------------------
  My sidearm is a piece of emergency equipment. It absolutely must
  be reliable, not "smart".
-----------------------------------------------------------------------
 5 days until April Fools' day

Reply via email to