HTML in E-Mails

Discussion of general topics about Mozilla Thunderbird
Post Reply
peterinwa
Posts: 19
Joined: January 8th, 2013, 11:38 am

HTML in E-Mails

Post by peterinwa »

When I insert HTML into my e-mails, and the HTML contains images which reside on the web, does Thunderbird get the images from the web and insert the images into the e-mail before it's sent?

Or does the e-mail get sent without the images, and they are inserted by the recipient's e-mail client when the recipient reads the e-mail?

The latter is how I thought it worked, but if I save such an e-mail in a folder and look at it later, it seems to be able to display the photos without going to the web. Perhaps it stores them when I originally read it.

I'd just like to understand, but one reason in particular is that I'm wondering if I re-send an old e-mail to someone will the photos only show up for the recipient if I still have them on the web.

Hope I'm making sense. Thank you.
User avatar
tanstaafl
Moderator
Posts: 49647
Joined: July 30th, 2003, 5:06 pm

Re: HTML in E-Mails

Post by tanstaafl »

HTML messages can contain embedded images (which are physically stored within the message as base64 encoded data in a MIME body part) or they may have links to a remote image (which is stored on some web site). If the image is embedded you can view it even if your Internet connection is down. See http://kb.mozillazine.org/Creating_comp ... ine_images

If you have a embedded image you will typically see a HTML img tag (how you define a image in HTML) that uses a CID to specify the location of the image stored in a MIME part. The CID value matches the value of the Content-ID: header in the MIME part. I have a HTML message which is basically just a 2MB embedded image. I've copied and pasted an excerpt to show how it stored the image:

<html>
<head>

<meta http-equiv="content-type" content="text/html; charset=ISO-8859-15">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<img alt="" src="cid:part1.09020004.05030809@yahoo.com"
height="1200" width="1600">
</body>
</html>

--------------070407040009020807040302
Content-Type: image/jpeg;
name="58919_1600x1200-wallpaper-cb1346964996.jpg"
Content-Transfer-Encoding: base64
Content-ID: <part1.09020004.05030809@yahoo.com>
Content-Disposition: inline;
filename="58919_1600x1200-wallpaper-cb1346964996.jpg"

/9j/4R2sRXhpZgAASUkqAAgAAAAOAAABAwABAAAAQAYAAAEBAwABAAAA6wQAAAIBAwADAAAA
tgAAAAMBAwABAAAAAQAAAAYBAwABAAAAAgAAABIBAwABAAAAAQAAABUBAwABAAAAAwAAABoB
BQABAAAAvAAAABsBBQABAAAAxAAAABwBAwABAAAAAQAAACgBAwABAAAAAgAAADEBAgAgAAAA
zAAAADIBAgAUAAAA7AAAAGmHBAABAAAAAAEAACwBAAAIAAgACACA/AoAECcAAID8CgAQJwAA
.....

That big block of characters all run together is the base64 encoded image. I sent that message using yahoo which is why the CID string contains @yahoo.com. However, I can store that message in Local Folders and view it even if my Internet connection is down.
peterinwa
Posts: 19
Joined: January 8th, 2013, 11:38 am

Re: HTML in E-Mails

Post by peterinwa »

Thank you for your very thorough reply. Unfortunately some of the terminology is over my little self-taught head.

I include images with:

Code: Select all

<img src="http://www.domain.com/subdirectory/filename.jpg">
But when I send them to myself and store them in a folder, their file size indicates that the photos are embedded.

Thank you.
User avatar
tanstaafl
Moderator
Posts: 49647
Joined: July 30th, 2003, 5:06 pm

Re: HTML in E-Mails

Post by tanstaafl »

I suggest you use view -> message source and look in the raw message source for a Content-Type: header that has a name= argument that specifies the image's filename.
thomasgd
Posts: 1
Joined: December 12th, 2016, 6:56 am

Re: HTML in E-Mails

Post by thomasgd »

tanstaafl wrote:HTML messages can contain embedded images (which are physically stored within the message as base64 encoded data in a MIME body part) or they may have links to a remote image (which is stored on some web site). If the image is embedded you can view it even if your Internet connection is down. See http://kb.mozillazine.org/Creating_comp ... ine_images

If you have a embedded image you will typically see a HTML img tag (how you define a image in HTML) that uses a CID to specify the location of the image stored in a MIME part. The CID value matches the value of the Content-ID: header in the MIME part. I have a HTML message which is basically just a 2MB embedded image. I've copied and pasted an excerpt to show how it stored the image:

<html>
<head>

<meta http-equiv="content-type" content="text/html; charset=ISO-8859-15">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<img alt="" src="cid:part1.09020004.05030809@yahoo.com"
height="1200" width="1600">
</body>
</html>

--------------070407040009020807040302
Content-Type: image/jpeg;
name="58919_1600x1200-wallpaper-cb1346964996.jpg"
Content-Transfer-Encoding: base64
Content-ID: <part1.09020004.05030809@yahoo.com>
Content-Disposition: inline;
filename="58919_1600x1200-wallpaper-cb1346964996.jpg"

/9j/4R2sRXhpZgAASUkqAAgAAAAOAAABAwABAAAAQAYAAAEBAwABAAAA6wQAAAIBAwADAAAA
tgAAAAMBAwABAAAAAQAAAAYBAwABAAAAAgAAABIBAwABAAAAAQAAABUBAwABAAAAAwAAABoB
BQABAAAAvAAAABsBBQABAAAAxAAAABwBAwABAAAAAQAAACgBAwABAAAAAgAAADEBAgAgAAAA
zAAAADIBAgAUAAAA7AAAAGmHBAABAAAAAAEAACwBAAAIAAgACACA/AoAECcAAID8CgAQJwAA
.....

That big block of characters all run together is the base64 encoded image. I sent that message using yahoo which is why the CID string contains @yahoo.com. However, I can store that message in Local Folders and view it even if my Internet connection is down.
Hi tanstafl,

Thank you for the reply, got a similar issue working over my last project, your suggestion was very helpful, have a nice day! :D :D :D
Post Reply