3
我試圖通過PHP imap functions
解析電子郵件時遇到問題。我想提取正文的文本,但沒有HTML鏈接(如mailto:xxxx)或編碼問題。我認爲我已經嘗試了(幾乎,我猜)一切。但與我接近所需的最終結果的唯一代碼,與未來:imap電子郵件解析的編碼
$bodyText = imap_fetchbody($inbox,$email_number,1.2);
if(!strlen($bodyText)>0)
{
$bodyText = imap_fetchbody($inbox,$email_number,1);
}
var_dump($bodyText);
的一點是,這個我收到的問題與最終的編碼(我認爲這就是問題所在)。因此,後續代碼var_dump輸出是一樣的東西:
> From: SomeOne <someone=40domain.com>
> To: Someone Else <someoneelse=40domain.com>
> =Date: lunes 23 de julio de 2012 13:04:43
> Subject: =46wd: =46W: URGE=21=21=21=21 Ley de Reforma del Congreso de 20=11
> =20
> Some text here, blah, blah, blah
> =20
> ---------- =46orwarded message ----------
> From: Whatever <whatever=40domain.com (mailto:whatever=40domain.com)>
> Date: 23 de julio de 2012 12:53
> Subject: =46wd: =46W: URGE=21=21=21=21 Ley de Reforma del Congreso de 20=11
> To: Someone <someone=40domain.com (mailto:someone=40domain=.com)>
> =20
> =20
> Some stuff=21=21
> =20
> ---------- =46orwarded message ----------
> =46rom: samuel l jackson <sanvuco=40domain.com (mailto:sanvuco=40domain.com)>
> Date: 2012/7/23
> Subject: =46W: URGE=21=21=21=21 Ley de Reforma del Congreso de 2011
> To: =22...Scary Monster=C2=B7=C2=B7=C2=B7 =C3=B2=5F=5F=C3=B3=22 <eowyn2=
6=40domain.com (mailto:eowyn26=40domain.com
我的意思是,有出現不良=40
,而不是@
和mailto:[email protected]
塊
感謝您
現在正在工作。非常感謝您的幫助 ;) – blacksoul 2012-07-24 14:40:16