PHP Classes

get full email from IMAP not working

Recommend this page to a friend!

      PHP MIME Email Message Parser  >  All threads  >  get full email from IMAP not working  >  (Un) Subscribe thread alerts  
Subject:get full email from IMAP not working
Summary:not working when i get header and body from imap functions
Messages:2
Author:eduardo
Date:2013-11-28 16:28:58
Update:2013-11-28 20:24:27
 

  1. get full email from IMAP not working   Reply   Report abuse  
Picture of eduardo eduardo - 2013-11-28 16:28:59
I need to parde emails i read from imap.
y connect to imap sucessfuly
then i do this test to read the first message only

$conn = imap_open("{pop.xxx.com.br:143/notls/novalidate-cert}INBOX", "[email protected]", "password");
$header = imap_fetchheader($conn, 1);
$s = imap_fetchstructure($conn, 1);
foreach ($s->parts as $partno=>$partarr){
$part = $partno+1;
$body .= imap_fetchbody($conn,1,$part);
}

require_once('./mimeparser/rfc822_addresses.php');
require_once('./mimeparser/mime_parser.php');
$mime=new mime_parser_class;
$mime->ignore_syntax_errors = 1;

$email = = $header.$body;
$parameters=array(
'Data'=>$email,
);
$mime->Decode($parameters, $decoded);
print_r($decoded);

RESULT empty array
Array
(
)

  2. Re: get full email from IMAP not working   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2013-11-28 20:24:27 - In reply to message 1 from eduardo
I think you need to add at least one line break between the header and body, so the class knows where the headers end.