I sent an email to myself to try to understand imap_body. I included 2 pictures in the email. One of the pictures I attached (a separate file, not part of the message), and one of the pictures was part of the message.
I’m not sure if I understand it right. But let’s see.
Here I have uploaded 2 pictures showing the print out of imap_body:
On the first picture I have marked an area with black, that area should be equal to the picture that was part of the message I sent to myself. Correct me if I’m wrong.
On the second picture I uploaded, I have marked an area black there as well. Anything that comes under that area should be equal to the image I attached to the email I sent to myself (the separate file that was not part of the message)
Is this true, or is the attached image (the one that was not part of the message, separate file) not included in the body?
Again, correct. The <img> tag in the first images refers to cid:c097c639-e476-4962-ac84-a8e6716a2c42. And in your second image there is a tag <c097c639-e476-4962-ac84-a8e6716a2c42>, so the image does indeed refer to that data.
From the looks of it that is base 64 encoded data, which should be returned to a (binary) image using base64_decode.