On Sun, 2010-10-24 at 16:26 -0230, Lawrence @ Rogers wrote: > Is there a quick way to compare 2 headers? I am seeing spam lately that > has an invalid e-mail address (one not hosted by us) set in the To: > header, but has the intended one in the Envelope-To: header > > What I would like to do is take the Envelope-To and run a regex to check > if the To: header contains it.
The To header is merely cosmetic. It does not have any solid meaning, in particular does not necessarily match the recipient. There are perfectly valid reasons to not have the actual recipient in the To header. Ever sent a message with Bcc recipients? Ever received a post via a mailing list? -- char *t="\10pse\0r\0dtu...@ghno\x4e\xc8\x79\xf4\xab\x51\x8a\x10\xf4\xf4\xc4"; main(){ char h,m=h=*t++,*x=t+2*h,c,i,l=*x,s=0; for (i=0;i<l;i++){ i%8? c<<=1: (c=*++x); c&128 && (s+=h); if (!(h>>=1)||!t[s+h]){ putchar(t[s]);h=m;s=0; }}}