5

I want to send a mail trough PHP with inline/embedded images (aka cid). The mail is succesfully sended and received correctly in Gmail. However, in Thunderbird (latest version for windows) the inline/embedded image is not displayed.

I followed the information given in this thread but it still doesn't work. So the inline/embedded image is displayed in Gmail but not in Thunderbird. Does somebody knows the problem here?

To: example@example.com
Subject: Test
From: noreply@test.com <noreply>
MIME-Version: 1.0
Content-Type: multipart/related; boundary="52cd9ebf4fb8c9b0547e93b82b3f3f6b"

--52cd9ebf4fb8c9b0547e93b82b3f3f6b
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>Test mail</title>
    </head>
    <body>
        <img src="cid:myImage" alt="This is a embedded image" />
    </body>
</html>

--52cd9ebf4fb8c9b0547e93b82b3f3f6b
Content-Type: image/jpg; name="myImage.jpg"
Content-Transfer-Encoding: base64
Content-ID: <myImage>
Content-Disposition: inline; filename="myImage.jpg"

[base64 encoded string goes here.]

--52cd9ebf4fb8c9b0547e93b82b3f3f6b--
Community
  • 1
  • 1
Piet
  • 2,188
  • 5
  • 19
  • 30

3 Answers3

1

Mm... In RFC 1521 say that the format of Content-Type header is something like this

The formal grammar for the content-type header field for text is as
follows:

text-type := "text" "/" text-subtype [";" "charset" "=" charset]

text-subtype := "plain" / extension-token

charset := "us-ascii"/ "iso-8859-1"/ "iso-8859-2"/ "iso-8859-3" / "iso-8859-4"/ "iso-8859-5"/ "iso-8859-6"/ "iso-8859-7" / "iso-8859-8" / "iso-8859-9" / extension-token ; case insensitive

I mean the content-type and next the charset But you put

Content-Type: image/jpg; name="myImage.jpg"

so... this maybe can break your image... another suggestion is put your content-ID in lowercase not camel case

regards Emiliano

Emiliano
  • 698
  • 9
  • 30
  • Thanks for the reply. The first line of your quote says "he content-type header field for text", so not for images. Also lowercasing the content-ID doesn't affect anything. So do you or someone else got a solution or is this a bug from Thunderbird? – Piet Dec 01 '16 at 18:03
  • Although it is an image the format is the same, only you need don't add the charset. Then try remove the text 'name="myImage.jpg" ' after your content-type and give me a shout if not working please. – Emiliano Dec 02 '16 at 14:55
1

I would check for correct case on the image extensions. I've found in the past that .jpg will display in a lot of browsers even if the image file extension is .JPG... but for some it will break or at least act inconsistently.

This may not be the case for you but worth taking a peak at.

Anthony Griggs
  • 1,469
  • 2
  • 17
  • 39
0

Thanks all for the reply's. I am not sure about it but it looks like the developers of thunderbird did a bugfix in their latest release because it does work now. If that is right, thanks devs of Thunderbird!

Piet
  • 2,188
  • 5
  • 19
  • 30