I have managed to display my emails using IMAP php library , without using any extra framework. the only problem I got is that I can not get embedded images. I can see the structure of my email with imap_fetchstrucure , that my image is somewhere in
[1] => stdClass Object
(
[type] => 5
[encoding] => 3
[ifsubtype] => 1
[subtype] => JPEG
[ifdescription] => 0
[ifid] => 1
[id] => <image002.jpg@01CE9203.CFB44C60>
[bytes] => 2668
[ifdisposition] => 0
[ifdparameters] => 0
[ifparameters] => 1
[parameters] => Array
(
[0] => stdClass Object
(
[attribute] => name
[value] => image002.jpg
) )
image002.jpg@01CE9203.CFB44C60, how can I get/show this image from Gmail? is there any standart URL to get the image www.gmail.com/image002.jpg ?
After searching and researching , found the solution , I will not get in detail how to read the body, But in this example I have in the 4th email and 3rd part a .jpg image embedded :
<?php
$mbox = imap_open($hostname,$username,$password)
or die('Cannot connect to Gmail: ' . imap_last_error());
$message=imap_fetchbody($mbox, 4,3);
$decoded_data = base64_decode($message);
file_put_contents('image002.jpg',$decoded_data);
?>
<img src="image002.jpg">
<?php
you have to save it first and then you can show it. Could not find a way to show it directly.