我正在使用 php imap 函数imap_header
来提取完整的标头并imap_fetch_overview
提取原始标头。这两个函数分别给了我 stdClass 对象和数组。
在进一步处理之前,我想始终清洁我的往返。有时 FROM 或 TO 可以包含这样的东西,
Test user <test@test.com>
目前在我的 FROM 中,我只看到Test User
并且没有电子邮件地址,直到我使用 firebug。
如何从这些对象、数组中获取 test@test.com ?
这是我得到的结果imap_fetch_overview
Array
(
[0] => stdClass Object
(
[subject] => Testing
[from] => Test User
[to] => testuser2@test.com
[date] => Wed, 17 Apr 2013 18:43:46 +0530
[message_id] => <abcdef1244.93784jgsfk@test.com>
[size] => 3443
[uid] => 1234
[msgno] => 123
[recent] => 0
[flagged] => 0
[answered] => 0
[deleted] => 0
[seen] => 0
[draft] => 0
[udate] => 1366204439
)
)
<test@test.com>
测试用户旁边有一个隐藏的。如何提取该电子邮件地址?
同样,这就是我从中得到的imap_header
stdClass Object
(
[date] => Wed, 17 Apr 2013 18:43:46 +0530
[Date] => Wed, 17 Apr 2013 18:43:46 +0530
[subject] => Test
[Subject] => Test
[message_id] => <abcdef1244.93784jgsfk@test.com>
[toaddress] => testuser@test.com
[to] => Array
(
[0] => stdClass Object
(
[mailbox] => testuser
[host] => test.com
)
)
[fromaddress] => Test User
[from] => Array
(
[0] => stdClass Object
(
[personal] => Test User
[mailbox] => test
[host] => test.com
)
)
[reply_toaddress] => Test User
[reply_to] => Array
(
[0] => stdClass Object
(
[personal] => Test User
[mailbox] => test
[host] => test.com
)
)
[senderaddress] => Test User
[sender] => Array
(
[0] => stdClass Object
(
[personal] => Test User
[mailbox] => test
[host] => test.com
)
)
[Recent] =>
[Unseen] => U
[Flagged] =>
[Answered] =>
[Deleted] =>
[Draft] =>
[Msgno] => 123
[MailDate] => 17-Apr-2013 13:13:59 +0000
[Size] => 3443
[udate] => 1366204439
)
Apreg_match
将是显而易见的答案,但似乎无法弄清楚如何从浏览器中看不到电子邮件地址但在使用 firebug 检查时存在的位上执行它。任何帮助表示赞赏。
谢谢。