PHP Classes

No message body using Mime parse

Recommend this page to a friend!

      PHP MIME Email Message Parser  >  All threads  >  No message body using Mime parse  >  (Un) Subscribe thread alerts  
Subject:No message body using Mime parse
Summary:html email empty decoded body
Messages:5
Author:Ketil Engmark
Date:2013-04-22 09:37:04
Update:2013-04-22 11:38:16
 

  1. No message body using Mime parse   Reply   Report abuse  
Picture of Ketil Engmark Ketil Engmark - 2013-04-22 09:37:04
Hi
I could not find in the forum a remedy for this. If it was addressed before i am sorry.
This is a new problem i have encountered.Its a great class.
This is the body part of source of message.


Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: 8bit
Content-Disposition: inline
test again html sending


The full source I save no problem.

The mime parser does not decode body so I get nothing in message writing to database. I dont even think its in mime.

After decoding html messages I converted to text. But that is not happening because no message body is being extracted.


I added more elseif's to body decode added text/html that did not work.
Try Content-Disposition: ?
I was thinking to pull it from the full source on some kind of condition if I cant figure it out.

Thanks


  2. Re: No message body using Mime parse   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2013-04-22 09:54:25 - In reply to message 1 from Ketil Engmark
Make sure you are not using the SkipBody option.

Other than that, the message sample you present above does not have any line of interval between the header lines and the body line. If there is no interval line, it is as if there is no body in the message.

  3. Re: No message body using Mime parse   Reply   Report abuse  
Picture of Ketil Engmark Ketil Engmark - 2013-04-22 10:36:12 - In reply to message 2 from Manuel Lemos
hi
no i removed the \n's just to put in the message here.

I will look at what you suggested.
Thank you.

  4. Re: No message body using Mime parse   Reply   Report abuse  
Picture of Ketil Engmark Ketil Engmark - 2013-04-22 10:43:27 - In reply to message 2 from Manuel Lemos
Hi
I think I may be using the wrong code.
Here is what I am using. It was working for text emails.

$mime=new mime_parser_class;
$mime->ignore_syntax_errors = 1;
$parameters=array('Data'=>$email,);//this is saved as source

$mime->Decode($parameters, $decoded);

//---------------------- FIND THE BODY -----------------------//

//get the message body
if(substr($decoded[0]['Headers']['content-type:'],0,strlen('text/plain')) == 'text/plain' && isset($decoded[0]['Body'])){

$body = $decoded[0]['Body'];

} elseif(substr($decoded[0]['Parts'][0]['Headers']['content-type:'],0,strlen('text/plain')) == 'text/plain' && isset($decoded[0]['Parts'][0]['Body'])) {

$body = $decoded[0]['Parts'][0]['Body'];

} elseif(substr($decoded[0]['Parts'][0]['Parts'][0]['Headers']['content-type:'],0,strlen('text/plain')) == 'text/plain' && isset($decoded[0]['Parts'][0]['Parts'][0]['Body'])) {

$body = $decoded[0]['Parts'][0]['Parts'][0]['Body'];

}


Is this ok to use?

Thanks

  5. Re: No message body using Mime parse   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2013-04-22 11:38:16 - In reply to message 4 from Ketil Engmark
It seems OK, but I would use the Analyze function as well so you do not have to go through the trouble of interpreting the results of the Decode function.