PHP Classes

The problem with parsing subject

Recommend this page to a friend!

      PHP MIME Email Message Parser  >  All threads  >  The problem with parsing subject  >  (Un) Subscribe thread alerts  
Subject:The problem with parsing subject
Summary:russian subjects
Messages:17
Author:Andrew
Date:2010-10-07 03:51:29
Update:2010-10-08 15:05:32
 
  1 - 10   11 - 17  

  11. Re: The problem with parsing subject   Reply   Report abuse  
Picture of Andrew Andrew - 2010-10-07 11:31:32 - In reply to message 10 from Manuel Lemos
You can write your example parsing the message?

$pop3->RetrieveMessage($message,$headers,$body,2);
$headm = "";

for($line=0;$line<count($headers);$line++)
$headm = $headm."".HtmlSpecialChars($headers[$line])."\n";

for($line=0;$line<count($body);$line++)
$headm = $headm."".HtmlSpecialChars($body[$line])."\n";

$headm = html_entity_decode($headm);

do parsing:

$msg_subject = '';
if ($mime->Decode(Array('Data' => $answer), $decoded)) {
if ($mime->Analyze($decoded[0], $results)) {
$msg_subject = $results['Subject'];
}
}


if ($msg_subject != "")
{
$headm = $msg_subject;
}
else
{
$headm = "No subject";
}

But the subjects, which includes Russian language not found.
Where could I make a mistake?

P.S Sorry for the trouble.

  12. Re: The problem with parsing subject   Reply   Report abuse  
Picture of Andrew Andrew - 2010-10-07 11:36:06 - In reply to message 11 from Andrew
Sorry,
before $msg_subject = '';

$answer = $headm;

  13. Re: The problem with parsing subject   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2010-10-07 11:48:26 - In reply to message 11 from Andrew
No, you need to pass the class the whole message data including the body because it expects that to parse it without errors.

You can use the POP3 class stream handler to treat messages as files and pass them to the MIME parser class. Take a look at the parse_message.php example script of the POP3 class:

phpclasses.org/browse/file/14695.ht ...

  14. Re: The problem with parsing subject   Reply   Report abuse  
Picture of Andrew Andrew - 2010-10-08 06:16:45 - In reply to message 13 from Manuel Lemos
Thank you
parse_message.php really helped me.
I made a mistake in specifying the function's arguments: RetrieveMessage ($ message, $ headers, $ body, 2);

What does the last argument? Number of rows from the body?


  15. Re: The problem with parsing subject   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2010-10-08 06:27:27 - In reply to message 14 from Andrew
Its message body lines.

  16. Re: The problem with parsing subject   Reply   Report abuse  
Picture of Andrew Andrew - 2010-10-08 09:35:25 - In reply to message 15 from Manuel Lemos
Many thanks,
Your classes are very helpful and easy to use.

P.S There are no buttons donate? =)

  17. Re: The problem with parsing subject   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2010-10-08 15:05:32 - In reply to message 16 from Andrew
Thanks, no donations are necessary, I work full time in the PHPClasses site.

You may want to become premium subscriber of the site and have other benefits:

phpclasses.org/premium/

 
  1 - 10   11 - 17