I'm trying to read an email body from gmail with imap_fetchbody
and PHP, but it does not work, it does not print the body.
The mail has attachments and its Mime-type is text/html
.
This is my code (with other kind of email, it works):
$string = quoted_printable_decode(imap_fetchbody($con,$email,2));
This is my PHP code:
$con is imap_open($server, $login, $password);
$email are email from imap_search all code is;
$connessione = imap_open($server, $login, $password);
$emails = imap_search($connessione, 'UNSEEN FROM "cc@cc.com"');
if (!empty($emails))
{
foreach ($emails as $email)
{
$string = quoted_printable_decode(imap_fetchbody($connessione,$email,2));
}
}
$string is this: ----boundary_13267_d232a838-e6ee-4fb8-bc76-85484f4b0772 Content-Type: text/html Content-Transfer-Encoding: base64 Cgo8aHRtbD4KPGhlYWQ+CjxNRVRBIGh....
Can someone help me?