Forum Moderators: coopster
From the headers below, How would I do this?
Return-Path: whocares@north.securenet-server.net
Received: from imta03.emeryville.ca.mail.comcast.net (LHLO
IMTA03.emeryville.ca.mail.comcast.net) (76.96.30.29) by
sz0042.wc.mail.comcast.net with LMTP; Sun, 1 Nov 2009 22:22:17 +0000 (UTC)
Received: from north.securenet-server.net ([207.45.187.106])
by IMTA03.emeryville.ca.mail.comcast.net with comcast
id zyNG1c00C2JA3Hb03yNGLo; Sun, 01 Nov 2009 22:22:16 +0000
X-CAA-SPAM: 00000
X-Authority-Analysis: v=1.0 c=1 a=3AX8gppiAAAA:8 a=C_IRinGWAAAA:8
a=WA2INzoXAAAA:8 a=h798RKh-AAAA:8 a=pGkEnt76smvyxH7oIAkA:9
a=VcHuqoGM7Wyjfx4nAwMA:7 a=riQBfJxW_C4jmrXrC7EJsPg4RrUA:4 a=vO7LOCX_yswA:10
a=si9q_4b84H0A:10
Received: from whocares by north.securenet-server.net with local (Exim 4.69)
(envelope-from <whocares@north.securenet-server.net>)
id 1N4ioP-00058U-W8
for whocares@comcast.net; Sun, 01 Nov 2009 17:22:13 -0500
To: Leftblank <whocares@comcast.net>
Subject: Test
From: Leftblank <whocares@privacyimage.com>
Message-Id: <E1N4ioP-00058U-W8@north.securenet-server.net>
Date: Sun, 01 Nov 2009 17:22:13 -0500
X-AntiAbuse: This header was added to track abuse, please include it with any abuse report
X-AntiAbuse: Primary Hostname - north.securenet-server.net
X-AntiAbuse: Original Domain - comcast.net
X-AntiAbuse: Originator/Caller UID/GID - [32541 32542] / [47 12]
X-AntiAbuse: Sender Address Domain - north.securenet-server.net
I am guessing search for the string:
for whocares@comcast.net; using for and ; to search between.
Thanks.
preg_match("/To:\s?([^>]+>)/i",$string,$stored);
echo $stored[1];
OR if you just want the e-mail from within the tags:
preg_match("/To:[^<]*<([^>])+>/i",$string,$stored);
echo $stored[1];
Something like the preceding should be close.
[] groups characters to match.
^ inside [ ] = NOT
+ is 'one or more of the preceding'
* is 'zero or more of the preceding'
? is 'zero or 1 of the preceding'
\s is any space character
() stores for reference
i (after the end delimiter) = Case Insensitive
So the 1st one says:
'Match To: followed by 0 or 1 spaces, then match anything that is not a > followed by a > and store anything after the space for later reference. Make all matches case-insensitive.'
The 2nd one says:
'Match To: followed by 0 or more characters that are not a <, followed by a <, then match and store anything not a > followed by a >. Make all matches case-insensitive.'