PHP Classes

Problem with page code

Recommend this page to a friend!

      POP3 e-mail client  >  All threads  >  Problem with page code  >  (Un) Subscribe thread alerts  
Subject:Problem with page code
Summary:Problem with page code
Messages:25
Author:Ggggggg
Date:2006-09-22 09:14:49
Update:2006-10-21 05:17:14
 
  1 - 10   11 - 20   21 - 25  

  1. Problem with page code   Reply   Report abuse  
Picture of Ggggggg Ggggggg - 2006-09-22 09:14:49
Hello! I`m using pop3 class in my project. But I`ve a problem that I can`t resolve :( When I try to get mail it have wrong page code:

From: =?windows-1251?B?zuvl4w==?= <lego@mgn.ru>
Subject: =?windows-1251?B?zOXt8vs=?=

=CB=E0=E2=E8=F2=E5 =CB=E5=ED=E8=ED=E0 =ED=E0 =FE=ED=E0=F1=F2=E5 =EE=ED =F0=
=E0=E1=EE=F2=E0=E5=F2 =E2 =C3=C0=C9


__________ =C8=ED=F4=EE=F0=EC=E0=F6=E8=FF NOD32 1.1766 (20060921) __________

=DD=F2=EE =F1=EE=EE=E1=F9=E5=ED=E8=E5 =EF=F0=EE=E2=E5=F0=E5=ED=EE =C0=ED=F2=E8=E2=E8=F0=F3=F1=ED=EE=E9 =F1=E8=F1=F2=E5=EC=EE=E9 NOD32.

How I can resolve this problem?

  2. Re: Problem with page code   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2006-09-22 17:33:54 - In reply to message 1 from Ggggggg
You are reading an encoded messages. Use the MIME parser class to parse and decode the message:

phpclasses.org/mimeparser

  3. Re: Problem with page code   Reply   Report abuse  
Picture of Ggggggg Ggggggg - 2006-09-23 16:40:05 - In reply to message 1 from Ggggggg
Thank you, I think this is what I need!! But I`ve find only example with reading from file (( Can I read and decode message from server without saving it to file ??

PS: Sorry my english isn`t very good :)

  4. Re: Problem with page code   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2006-09-23 17:20:40 - In reply to message 3 from Ggggggg
Take a look at the parse_message.php example that comes with the POP3 class.

  5. Re: Problem with page code   Reply   Report abuse  
Picture of Ggggggg Ggggggg - 2006-09-24 16:37:38 - In reply to message 4 from Manuel Lemos
Here is result of parse_message.php :
Message 1:
array(5) {
["Headers"]=>
array(16) {
["return-path:"]=>
string(13) ""
["received:"]=>
array(4) {
[0]=>
string(153) "from [62.165.51.253] (port=55942 helo=jupiter.mgn.ru) by mx16.mail.ru with esmtp id 1GQbmY-000Jpw-00 for netgai@mail.ru; Fri, 22 Sep 2006 07:32:54 +0400"
[1]=>
string(153) "from localhost (unknown [127.0.0.1]) by jupiter.mgn.ru (Sendmail) with ESMTP id 0DAD33BA240 for ; Fri, 22 Sep 2006 09:32:54 +0600 (YEKST)"
[2]=>
string(188) "from jupiter.mgn.ru ([127.0.0.1]) by localhost (jupiter.mgn.ru [127.0.0.1]) (Antrivirus, port 10024) with LMTP id oDPhfH76nFSK for ; Fri, 22 Sep 2006 09:32:53 +0600 (YEKST)"
[3]=>
string(180) "from magn-mmb.vpn.mgn.ru (magn-mmb.vpn.mgn.ru [83.146.101.160]) by jupiter.mgn.ru (Sendmail) with ESMTP id DFCC7107895 for ; Fri, 22 Sep 2006 09:32:53 +0600 (YEKST)"
}
["received-spf:"]=>
string(155) "pass (mx16.mail.ru: domain of mgn.ru designates 62.165.51.253 as permitted sender) client-ip=62.165.51.253; envelope-from=lego@mgn.ru; helo=jupiter.mgn.ru;"
["x-virus-scanned:"]=>
string(19) "Antivirus at mgn.ru"
["date:"]=>
string(31) "Fri, 22 Sep 2006 09:33:11 +0600"
["from:"]=>
string(41) "=?windows-1251?B?zuvl4w==?= "
["x-mailer:"]=>
string(32) "The Bat! (v3.80.06) Professional"
["reply-to:"]=>
string(41) "=?windows-1251?B?zuvl4w==?= "
["x-priority:"]=>
string(10) "3 (Normal)"
["message-id:"]=>
string(34) "<1646493932.20060922093311@mgn.ru>"
["to:"]=>
string(14) "netgai@mail.ru"
["subject:"]=>
string(27) "=?windows-1251?B?zOXt8vs=?="
["mime-version:"]=>
string(3) "1.0"
["content-type:"]=>
string(32) "text/plain; charset=windows-1251"
["content-transfer-encoding:"]=>
string(16) "quoted-printable"
["x-spam:"]=>
string(12) "Not detected"
}
["Parts"]=>
array(0) {
}
["DecodedHeaders"]=>
array(3) {
["from:"]=>
array(1) {
[0]=>
array(1) {
[0]=>
array(2) {
["Value"]=>
string(18) "&#1054;&#1083;&#1077;&#1075; "
["Encoding"]=>
string(12) "WINDOWS-1251"
}
}
}
["reply-to:"]=>
array(1) {
[0]=>
array(1) {
[0]=>
array(2) {
["Value"]=>
string(18) "&#1054;&#1083;&#1077;&#1075; "
["Encoding"]=>
string(12) "WINDOWS-1251"
}
}
}
["subject:"]=>
array(1) {
[0]=>
array(1) {
[0]=>
array(2) {
["Value"]=>
string(5) "&#1052;&#1077;&#1085;&#1090;&#1099;"
["Encoding"]=>
string(12) "WINDOWS-1251"
}
}
}
}
["BodyPart"]=>
int(1)
["BodyLength"]=>
int(186)
}

But were is body of the message ?? And how I can call, let say, array ["Headers"] without calling to other arrays??



  6. Re: Problem with page code   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2006-09-24 18:24:25 - In reply to message 5 from Ggggggg
In the example there is a parameters array with the option SkipBody . If you remove that option, it will retrieve the body parts into the array. If you also uncomment the option SaveBody, it will save the body parts to the specified directory.

  7. Re: Problem with page code   Reply   Report abuse  
Picture of Ggggggg Ggggggg - 2006-09-25 12:06:16 - In reply to message 6 from Manuel Lemos
Thanks a lot.And what are the keys of arrays $decoded[$message]??

  8. Re: Problem with page code   Reply   Report abuse  
Picture of Ggggggg Ggggggg - 2006-09-25 13:21:21 - In reply to message 7 from Ggggggg
I call to arrays that I need with this script:
for($i = 0; $i < count($decoded); $i++)
{
$message =$decoded[$i];
echo '<pre>Message #',($i+1),':',"\n";
var_dump($message['subject:']);
var_dump($message['Body']);
echo '</pre>';
}

But it`s returns Subject as NULL (( Body returns ok. What is wrong ??

  9. Re: Problem with page code   Reply   Report abuse  
Picture of Ggggggg Ggggggg - 2006-09-25 17:23:28 - In reply to message 8 from Ggggggg
I`ve already resolve this problem. But your script is reading only 1 message ??

  10. Re: Problem with page code   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2006-09-25 18:16:58 - In reply to message 9 from Ggggggg
The example script picks the first message in the mailbox. That is defined by the $message variable. Change this variable to pick other messages.

 
  1 - 10   11 - 20   21 - 25