PHP Classes

extract subject incorrect

Recommend this page to a friend!

      PHP MIME Email Message Parser  >  All threads  >  extract subject incorrect  >  (Un) Subscribe thread alerts  
Subject:extract subject incorrect
Summary:extract subject incorrect
Messages:5
Author:helloxuweifu
Date:2009-04-26 02:35:38
Update:2009-04-26 16:54:17
 

  1. extract subject incorrect   Reply   Report abuse  
Picture of helloxuweifu helloxuweifu - 2009-04-26 02:35:38
hi manuel:

why this eml file is special?the subject can't be extract correctly.
here is the entire file contents.




Received: (qmail 32505 invoked by uid 0); 26 Apr 2009 02:12:21 -0000
Received: from unknown (HELO joenb)
([email protected]@119.124.123.36) by smartdotweb.hk with
SMTP; 26 Apr 2009 02:12:21 -0000
Message-ID: <8C3D211D583647B686037FBFE12A7A22@joenb>
From: "Joe of Smart.Web Ltd" <[email protected]>
To: "Joe of Smart.Web Ltd" <[email protected]>
Subject: =?gb2312?B?Rnc6IMjnufu05tTao6m9q8bkyejWw9DeuMQ=?=
Date: Sun, 26 Apr 2009 10:14:09 +0800
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----=_NextPart_000_0050_01C9C657.BD653230"
X-Priority: 3
X-Msmail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2900.5512
X-Mimeole: Produced By Microsoft MimeOLE V6.00.2900.5579

This is a multi-part message in MIME format.

------=_NextPart_000_0050_01C9C657.BD653230
Content-Type: text/plain;
charset="gb2312"
Content-Transfer-Encoding: base64

DQotLS0tLSBPcmlnaW5hbCBNZXNzYWdlIC0tLS0tIA0KRnJvbTogSm9lIG9mIFNtYXJ0LldlYiBM
dGQgDQpUbzogSm9lIG9mIFNtYXJ0LldlYiBMdGQgDQpTZW50OiBNb25kYXksIEFwcmlsIDEzLCAy
MDA5IDY6MDMgUE0NClN1YmplY3Q6IMjnufu05tTao6m9q8bkyejWw9DeuMQNCg0KDQrI57n7tObU
2qOpvavG5Mno1sPQ3rjE

------=_NextPart_000_0050_01C9C657.BD653230
Content-Type: text/html;
charset="gb2312"
Content-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8RElWPjxCUj48L0RJVj4NCjxESVY+
PEZPTlQgZmFjZT1BcmlhbCBzaXplPTI+yOe5+7Tm1Nqjqb2rxuTJ6NbD0N64xDwvRk9OVD48L0RJ
Vj48L0JPRFk+PC9IVE1MPg0K

------=_NextPart_000_0050_01C9C657.BD653230--


  2. Re: extract subject incorrect   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2009-04-26 03:15:39 - In reply to message 1 from helloxuweifu
I tried that message and the class extracted the subject correctly. What is your difficulty?

  3. Re: extract subject incorrect   Reply   Report abuse  
Picture of helloxuweifu helloxuweifu - 2009-04-26 11:22:47 - In reply to message 2 from Manuel Lemos
manuel,it is my problem,my page charset is utf-8,so when i use iconv function.
iconv("gb2312","utf-8",$results['Subject']);
the result is correct.

but there is a new problem here .
Subject: =?gb2312?B?dGVzdC4uLi4ujqeDyYKAuL28/rXE?=

echo iconv("gb2312","utf-8",base64_decode(dGVzdC4uLi4ujqeDyYKAuL28/rXE))." <br>";
Warning: Division by zero .

the subject extract is incorrect,why?????????




thank you very very very much!



  4. Re: extract subject incorrect   Reply   Report abuse  
Picture of helloxuweifu helloxuweifu - 2009-04-26 11:25:55 - In reply to message 3 from helloxuweifu
array(11) { ["Type"]=> string(4) "html" ["Description"]=> string(12) "HTML message" ["Encoding"]=> string(6) "gb2312" ["DataFile"]=> string(13) "test/tmp\1862" ["Alternative"]=> array(1) { [0]=> array(4) { ["Type"]=> string(4) "text" ["Description"]=> string(12) "Text message" ["Encoding"]=> string(6) "gb2312" ["DataFile"]=> string(13) "test/tmp\1861" } } ["Attachments"]=> array(2) { [0]=> array(5) { ["Type"]=> string(7) "ms-word" ["Description"]=> string(49) "Word processing document in Microsoft Word format" ["DataFile"]=> string(17) "test/tmp\1863.doc" ["FileName"]=> string(41) "&#551;?&#957;?NAS&#282;??&#1005;&#319;¼&#1267;&#612;&#938;????&#290;&#332;.doc" ["FileDisposition"]=> string(10) "attachment" } [1]=> array(5) { ["Type"]=> string(7) "ms-word" ["Description"]=> string(49) "Word processing document in Microsoft Word format" ["DataFile"]=> string(17) "test/tmp\1864.doc" ["FileName"]=> string(48) "090424-&#551;?&#957;?NAS&#282;??&#1005;&#319;¼&#1267;&#612;&#938;????&#290;&#332;.doc" ["FileDisposition"]=> string(10) "attachment" } } ["Subject"]=> string(21) "test.....???&#578;?????["SubjectEncoding"]=> string(6) "gb2312" ["Date"]=> string(31) "Sun, 26 Apr 2009 18:18:18 +0800" ["From"]=> array(1) { [0]=> array(2) { ["address"]=> string(31) "[email protected]" ["name"]=> string(20) "Joe of Smart.Web Ltd" } } ["To"]=> array(1) { [0]=> array(2) { ["address"]=> string(24) "[email protected]" ["name"]=> string(10) "'luo andy'" } } }

  5. Re: extract subject incorrect   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2009-04-26 16:54:17 - In reply to message 3 from helloxuweifu
The class decodes the subject for you. There is no need to use iconv function.

Just look at the Subject and SubjectEncoding entries of the array returned by the Analyze function.