Imap Body And Images Attached

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:

Image 1:

!

Image 2:

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?

You are correct.

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.

Hello rpkamp. Thanks for your reply.

If I attach large pictures for example 6mb then it will be a lot of code. I work on a mail client, how can I manage it at best and how should I embed it in the email.

I also tested sending a small icon on one occasion, to see if I could decod it in “base64 to image converter online”. However, it did not work

What for? Isn’t there any client out there that fits your needs?

It’s probably easiest to extract the image from the mail body and store it somewhere else and then link to it.

What did not work? What website did you use?

But it looks like both images have the same cid. Does this mean that only one of the images is in the body?

Yes. From the current images I can’t say where the other image is.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.