Creating complex mails with inline images

From MozillaZine Knowledge Base
Jump to navigationJump to search
This article was written for Thunderbird but also applies to Mozilla Suite / SeaMonkey (though some menu sequences may differ).

Include images from files

The HTML format allows to place an image within the message text rather than as an attachment. Neither of these methods work in plain-text composition mode, thus verify that the top-most box is checked in Tools → Account Settings → (account) → Composition & Addressing. There are several ways how to do this. This section describes including an image from a local file, whereas the next section describes inserting an image located at a remote server.

Browse for an image

  1. In the Compose window, select "Insert → Image". The "Image Properties" dialog box will appear.
  2. Click on "Choose file" to locate the file that contains the image.
  3. Put some words in the "Alternate text:" field or select "Don't use alternate text", otherwise Thunderbird refuses to send the message.
    • Important: Leave the "Attach this image to the message" box checked.
  4. then press "OK" to exit the "Image Properties" dialog.

Drag & drop images

You can also drag the image file directly from your desktop or an open folder into your message-composition window to place it there. By default, no alternate text is specified. If you want to include an alternate text, double-click on the image in your message to make the respective settings in the Image Properties dialog.

Copy & paste images

You can copy any image or the content of any open window to the clipboard of your operating system, then paste it into the message. Compared to using the "Insert" menu or drag & drop method, pasting will usually involve recoding of the image, thus may change quality and size. Thus, the other two methods are preferred to retain the original format of an image.

After complaints that Thunderbird 2.0 pastes images in a low-quality JPEG format (see "Hack" below to increase the quality if you are still using 2.0, though it's no longer supported), Thunderbird 3.x now pastes in lossless PNG format by default instead. This substantially improves the image quality for screen shots from applications, but increases the size for photographs which were initially encoded in JPEG. To allow pasting in JPEG, change the clipboard.paste_image_type preference from its default 1 to 0. Note that the setting of 2 to prefer pasting in GIF is not supported on Windows, and depends on the copying application if it is made available on other platforms.

Hack: As a workaround for Thunderbird 2.0 on Windows, and if you feel comfortable modifying programs, you can increase the pasting quality with a hex editor (for example, XVI32). Go to Thunderbird's installation directory. Make a backup copy of the main Thunderbird executable (for example, thunderbird.exe on Windows), then use the hex editor to edit the original. Search for the Unicode string transparency=none and change it to: quality=100   Either pad the new string with six spaces, or add a NUL byte (hex 00) at the end of the new string, so that the length of the file remains exactly the same. Every time Thunderbird updates to a new version, you will have to edit the updated executable file. Thunderbird 3.x uses a quality of 93 rather than 50 if set to recode in JPEG, and the 2.0 hack will no longer work to change it.

Note: On Linux, copy & paste or drag & drop may not work for Thunderbird 2.0, or paste a file path as text instead (this is fixed in 3.0).

Remote images

In an HTML-formatted message, you can send mail with a pointer to a picture rather than embedding the actual picture in the message. The advantage is that the message is much smaller. The disadvantage is that the picture is physically on another server; if the image is unavailable—now or in the future—your recipient will not see it. Some e-mail clients might also be configured to block remote images.

  1. In the Compose window, select "Insert -> Image". The "Image Properties" dialog box will appear.
  2. Fill in the "Image Location" field with the URI of the picture. You can type it in if you know it, or you can paste it in. For example, in Firefox, right-click on the image and choose "Copy Image Location". Then in Thunderbird right-click in the "Image Location" field to paste in the URI.
  3. Put some words in the "Alternate text:" field or select "Don't use alternate text", otherwise Thunderbird refuses to send the message.
  4. Next, uncheck the "Attach this image to the message" box (Thunderbird 2.0 and equivalent), or alternatively:
    • Click on the "Advanced Edit" button. The "Advanced Property Editor" dialog will open.
    • In the "Attribute:" field at the bottom, type moz-do-not-send.
    • In the "Value:" field at the bottom, type true.
    • Press the "OK" button to exit the "Advanced Property Editor" dialog
  5. then press "OK" to exit the "Image Properties" dialog.

Drag & drop images

Rather than copy-pasting the URI of an image within a web page manually, you can also drag the image directly from a web page you are viewing with Firefox or SeaMonkey into your open HTML message-composition window to place it there. By default, the image will be attached to the message before sending. If you want to include a reference to the remote image only without attaching it, double-click on the image in your message and uncheck the respective box in the Image Properties dialog.

Inserted HTML

If you create your HTML message in some other application, and insert it in the message by using Thunderbird's Insert – HTML... dialog, then you can usually use that other application to add the moz-do-not-send attribute to each IMG tag. For example, the resulting tag might look like:

<img src="http://static.mozillazine.org/common/images/blimp.png" moz-do-not-send="true">

Images from other messages

You can drag & drop images that are part of (or attached to) a message which you are currently displaying to a new message you are composing.

Drag into message body

  1. Select the image either from the message body or the attachment pane of the original message.
  2. Click the left mouse button and hold down while dragging into the desired location within your own message.
    • Note that remote images will retain their remote character. Again, you can change that in the Image Properties.
    • Images that were attachments of the original message have the "Attach this image to the message" box checked. This should not be changed as the URL only has meaning within your account.

Place as attachment

  1. Select the image either from the message body or the attachment pane of the original message.
  2. Click the left mouse button and hold down while dragging into the attachment pane of your own message.
    • In Thunderbird, the attachment pane becomes visible when dragging the image over the addressing area.
    • Placing the image as attachment will always attach it to that message.

Images referred over CSS

If you create a new HTML-formatted message and use external URIs for images, Thunderbird will automatically download them and attach them as inline images. However, that does not work with images referred over CSS, meaning the absolute URI stays. The problem with this is that some mail clients (including Thunderbird itself) will provide the recipient with a security/privacy warning that external images will be excluded instead of displayed inline.

Related bugs

  • Bug 344248 – PNG from clipboards pastes as JPEG instead
  • Bug 384116 – Pasting an image from clipboard uses bad quality JPEG-compression
  • Bug 444800 – Cannot retrieve image data from clipboard in lossless format (Windows)
  • Bug 557708 – Drag and drop of images from Firefox to Thunderbird as attachment results in BMP conversion (Windows)
  • Bug 596797 – moz-do-not-send="true" in HTML signature or pasted HTML gets ignored/removed

See also

External Links