Mail content types

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).

This article describes the types of e-mail message that you can work with in Thunderbird: HTML and plain text. Technically, HTML and plain text are different content types, but Thunderbird's user interface refers to them as the "format" of the message.

Your choices in Thunderbird for writing messages, sending messages, and displaying messages are all slightly different.

Note:  For information about content types of attachments, see: Actions for attachment file types

Comparing HTML and plain text

HTML supports font and color changes, graphical formatting of lists and tables, and other visual effects in the way that you see on web pages. It makes messages easier to read by allowing you to use proportional fonts in a clear layout.

Plain text does not support font or color changes. You can only format lists and tables by careful spacing, and the spacing only works well if you use a monospaced font. This tends to make messages more difficult to read.

Thunderbird normally uses an advanced form of plain text that supports flowed paragraphs and certain other HTML-like features. (In a flowed paragraph, the lines automaticlly break at the edge of the window or pane, so that you never have to scroll sideways to see the ends of lines.)

Writing messages

When you write a message in Thunderbird, you use either an HTML editor or a plain text editor. If you use an HTML editor, then you can send the message in HTML, plain text, or both. If you use a plain text editor, then you can only send the message in plain text.

You usually specify which type of editor to use by identity. In your account settings, on the Composition & Addressing page, either check or clear the checkbox: "Compose messages in HTML format"   This setting is for the account's default identity. To change the setting for the account's other identities, press the account's Manage Identities... button and edit each identity. Thunderbird uses the setting for the message's initial identity. If you change the message's identity (by choosing a different From address), Thunderbird does not change the editor. For more information about identities and their settings, see: Mail concepts

You can tell which type of editor you are using by looking at the menu bar. If it has a Format menu, then you are using an HTML editor. If not, then you are using a plain text editor.

Confusingly, you can switch the HTML editor to plain text mode and back, but if you start with the plain text editor you cannot switch it to HTML.

Changing the type for a one-off message

For a one-off message, you can change the type you selected in your account settings. Hold down the Shift key while you press a toolbar button to write the message. The toolbar button might be Write, Reply, Reply to All, or Forward. If you specified HTML in your account settings, Thunderbird writes this one message as plain text. If you specified plain text, Thunderbird writes this one message as HTML.

Notes 

  • This only works for the Forward button if you have set Thunderbird to forward messages as attachments. To work with that setting, choose: Options (Preferences) – Composition – General
  • This only works with toolbar buttons. If you are using keyboard navigation, then you cannot change the type for a one-off message in this way.

Enhanced HTML features

When you use the HTML editor, you can use all the basic features of HTML. Thunderbird provides some enhancements that go beyond these basic features. These enhancements are built from standard HTML tags, so if recipients of your message can view standard HTML, they can see these enhancements in your message:

  • Thunderbird automatically generates links from things that look like URLs and e-mail addresses. See: Links generated automatically
  • If your message contains headings, then you can optionally insert a table of contents. Choose Insert – Table of Contents. Thunderbird builds the table of contents from the headings. If you add more headings, update the table of contents before you send the message.

If you know the HTML language, you can extend the basic features by typing HTML tags—choose: Insert – HTML... To edit existing tags in the message, first select the part you want to edit (or the whole message), then choose: Insert – HTML...   For more information, see: Edit HTML source

Enhanced plain text features

Thunderbird and some other e-mail clients support enhanced plain text features:

  • To make text bold, type an asterisk before and after: *this is bold*
  • To make text italic, type a slash before and after: /this is italic/
  • To underline text, type an underline before and after: _this is underlined_
  • Type smileys (emoticons) to convey your feeling about parts of the message, for example: :) (happy)
  • Type URLs in full so that readers can use them as links, for example: http://www.mozilla.org

Sending messages

If you compose a message as plain text, then you can only send it as plain text.

If you compose a message as HTML, then you can send it as plain text, HTML, or both. However, Thunderbird normally makes the choice of type for you automatically, depending on the recipients of the message or their domains. This corresponds to the default menu choice (in the Compose window) Options – Format – Auto-Detect. The Mail Tweak extension has a Force HTML tweak that can change the default.

To specify the content type for the message you are writing, in the Compose window choose Options – Format – and then the content type.

If you send both plain text and HTML, Thunderbird combines both content types into one message. Technically, it is known as a multipart message. Each recipient's mail client chooses which to display, depending on its capabilities and the recipient's preferences.

Plain text by default

If your message does not use any HTML features (bold, underline, italics, colors, etc.), and if Thunderbird has no information about the recipients' preferences, then it sends plain text by default.

To send HTML by default, use a signature that includes some HTML feature. Even something invisible like an italic space is enough to make the content type HTML:

<i> </i>

Auto-detect by recipient

To specify the content type for a recipient, create or edit the recipient's card in your address book. On the Contact page, in the Internet group, set: "Prefers to receive messages formatted as"

Auto-detect by domain

A domain is the part of an e-mail address following the @ sign. For example, someone whose e-mail address is someone@example.com is in the domain: example.com

To specify the content type for a domain, choose Options (Preferences) – Composition – General – Send Options...

Auto-detect conflicts

If you try to send an HTML message, but auto-detect finds a recipient who prefers plain text, Thunderbird does one of four things:

  • Sends both plain text and HTML together in the same message
  • Sends only HTML, even though recipients might not like it
  • Sends only plain text, even though the formatting in your message might be lost
  • Asks you what to do

To configure this, choose Options (Preferences) – Composition – General – Send Options...

If you try to send a plain text message, but auto-detect finds a recipient who prefers HTML, then Thunderbird sends plain text anyway. All recipients can read plain text, even if they prefer HTML.

Disabling paragraph flow

To disable paragraph flow when you send plain text messages, and in the plain text part of multipart messages, set the preference:

mailnews.send_plaintext_flowed  false

Note:  Disabling paragraph flow can make your messages difficult for other people to read. They might see line breaks in strange places. If you have quoted another message, the quote might not be displayed in the normal way.

Reading messages

When you read a plain text message, you can only read it as plain text. However, various settings control the ways in which Thunderbird enhances plain text messages.

When you read an HTML message, you can read it as the original HTML, as simple HTML, or as plain text. To specify, choose: View – Message Body As

Original HTML

If you choose View – Message Body As – Original HTML, then you see HTML messages in their original form, except that:

  • For privacy reasons you can choose not to allow messages to run JavaScript code.
  • For privacy reasons you can choose not to allow messages to download remote images.
  • Some messages might contain non-standard HTML that Thunderbird does not support.

For privacy settings, choose: Options (Preferences) – Privacy – General

Note:  There are normally no security issues when you read a message in Thunderbird. It is not normally possible for hostile code to attack your computer just because you read a message. But if you open an attachment, then Thunderbird passes the attachment to your operating system or to some other application. Your operating system or the other application might allow the attachment to attack your computer.

Simple HTML

If you choose View – Message Body As – Simple HTML, then you see HTML messages in a simplified form. Thunderbird does not run JavaScript code, and does not download remote images. Simple HTML preserves basic HTML formatting.

Plain text

If the message is plain text, then you always see plain text.

If you choose View – Message Body As – Plain Text, then you see plain text even if the message is really HTML. If the message is multipart, then you see the plain text part. Otherwise Thunderbird converts the HTML message to plain text.

Thunderbird normally enhances plain text by supporting certain HTML-like features:

  • Bold, italic and underlined text.
  • Smileys displayed as images.
  • Attached images displayed in the body of the message.
  • Links displayed in blue, and underlined.
  • Flowed paragraphs (if the message was sent using flowed paragraphs)
  • Quoted paragraphs outlined with colored bars (if the message was sent using flowed paragraphs)
  • Signatures displayed in gray.

The supported smileys are:

:-)  :)  smile
:-D    laughing
:-(  :(  frown
:-[    embarassed
;-)  ;)  wink
:-\    undecided
:-P  ;-P  tongue
=-O    surprise
:-*    kiss
>:o  >:-o  yell
8-)    cool
:-$    money
:-!    foot
O:-)    innocent
:'(    cry
:-X    sealed

Optionally, you can turn off Thunderbird's plain text enhancements:

  • To remove images and other attachments from the body of the message, go to the View menu ensure that Display Attachments Inline is not checked.
  • To smileys, choose Options (Preferences) – Display – Formatting, and clear the checkbox "Display emoticons as graphics"
  • To disable bold, underline, and italics, add this to your userContent.css file:
.moz-txt-star {font-weight: normal;}
.moz-txt-underscore {text-decoration: none !important;}
.moz-txt-slash {font-style: normal;}
.moz-text-flowed :link, .moz-text-plain :link {
  color: inherit !important;
  text-decoration: inherit !important;
  cursor: inherit !important;
  }
  • To disable flowed paragraphs, enforcing line breaks as formatted in the message, set the preference:
mailnews.display.disable_format_flowed_support  true
  • To disable colored quote bars, set the preference:
mail.quoted_graphical  false

and add this rule to your userContent.css file:

.moz-text-plain blockquote[type=cite]
   {border: none !important; padding: 0 !important;}
.moz-txt-sig {color: inherit !important;}

Advanced

This section mentions some features for advanced users, or for troubleshooting.

Message source

To see the encoded data in a message, select the message in a folder and choose View – Message Source...

You can look at the message source to check all of a message's headers, including its content type. For example, if the message is plain text, then you see a line like:

Content-Type: text/plain; charset=ISO-8859-15; format=flowed

If the message is HTML, then you see a line like:

Content-Type: text/html; charset=ISO-8859-15

If the message is multipart, then you see a line like:

Content-Type: multipart/alternative;

and below that line you see the separate plain text and HTML parts with their own Content-Type headers.

Parts of the encoded data might look similar to the actual message, but it is not intended to be exactly the same. You cannot work with the encoded data directly in Thunderbird. To understand the encoding, see the RFCs linked below.

Charset (character encoding)

The message charset is known in Thunderbird as the character encoding. When you write a message in Thunderbird, you are writing in Unicode. The charset is only applied when you send a message or save it as a draft.

When you send an HTML message, Thunderbird uses HTML to encode any characters in the message that are not supported by the charset. This means that the charset does not matter much, because HTML supports Unicode.

When you send a plain text or multipart message, Thunderbird normally uses your default charset to encode the message. To set the default charset for sending messages, choose Options (Preferences) – Display – Fonts. (Yes, Display – Fonts, not Composition!)

Notes: 

  • For normal use, do not check the box "Use the default character encoding in replies". If you check that box, it can cause problems for people who receive your replies.
  • For normal use, do not check the box "Apply the default character encoding to all incoming messages". If you check that box, it can cause problems for you when you read messages you receive.

To specify a different charset for sending a particular message, in the Compose window choose Options – Character Encoding.

If you send a plain text message containing characters that are not supported in the charset, then Thunderbird might quietly send the message in a different charset, or it might warn you and invite you to use UTF-8.

If you send a multipart message containing characters that are not supported in the charset, then Thunderbird replaces (transliterates) those characters in the plain text part. In some cases Thunderbird uses meaningful replacements, like EUR for €. In other cases it uses question marks.

Plain text transliteration

When Thunderbird generates multipart plain text in a charset that does not support all the characters in the message, it transliterates certain characters. For example, if the euro currency symbol € is not supported, Thunderbird replaces it with EUR.

To customize this conversion, go to Thunderbird's installation directory, then to the res/entityTables directory there. Under Mac OS X you find the wanted directory only within the application itself. An easy technique to access it is to use the Finder's menu command "Go -> Go to Folder..." and enter /Applications/Thunderbird.app/Contents/MacOS/res/entityTables. Alternatively Control-click the application and choose from the pop-up menu the command "Show Package Contents" and then go to Contents/MacOS/res/entityTables directory there. Edit the file: transliterate.properties.

ASCII

ASCII is a limited charset properly known as US-ASCII. There is rarely any need to use it, because other charsets support all its characters.

To enable US-ASCII for sending messages, set the preference:

mail.label_ascii_only_mail_as_us_ascii  true

To enable ASCII as an equivalent to US-ASCII for displaying messages, go to Thunderbird's installation directory, then to the res directory there. Edit the file charsetalias.properties and add the entry:

ascii=us-ascii

Color of quoted text in plain-text replies

To change the default display color for quoted text in plain-text replies, add the following to your userContent.css file:

/* Quoted text in plain-text replies */
span[_moz_quote=true] {color: green;}

Replace "green" with whatever color you want to use.

See also

External links

Internet standards:

  • RFC 2045 Format of Internet Message Bodies (MIME)
  • RFC 2046 Multipurpose Internet Mail Extensions (MIME) Media Types
  • RFC 2854 The 'text/html' Media Type
  • RFC 3676 The Text/Plain Format Parameter (includes format flowed)
  • RFC 5322 Internet message format

Wikipedia: