messengerUtilities API
The messengerUtilities API provides helpful methods for working with messages and emails.
Functions
convertToPlainText(body, [options])
– [Added in TB 137]
Converts the provided body to readable plain text, without tags and leading/trailing whitespace.
Parameters
body
The to-be-converted body.
options
decodeMimeHeader(headerName, headerValue, [isMailBoxHeader])
– [Added in TB 137]
Decode the provided header into a readable format according to RFC 2047.
Parameters
headerName
headerValue
isMailBoxHeader
Headers containing multiple mailbox strings need special handling. For example the header =?UTF-8?Q?H=C3=B6rst=2C_Kenny?= <K.Hoerst@invalid>, new@thunderbird.bug will be wrongly decoded to Hörst, Kenny <K.Hoerst@invalid>, new@thunderbird.bug, corrupting the structure of the first mailbox string. This option overrides the default behavior of treating the headers defined in MailboxHeaders as mailbox headers.
encodeMimeHeader(headerName, headerValue, [isMailBoxHeader])
– [Added in TB 137]
Encode the provided header according to RFC 2047.
Parameters
headerName
headerValue
isMailBoxHeader
Headers containing multiple mailbox strings need special handling. This option overrides the default behavior of treating the headers defined in MailboxHeaders as mailbox headers.
formatFileSize(sizeInBytes)
– [Added in TB 137]
Returns the provided file size in a human readable format (e.g. 12 bytes or 11,4 GB).
parseMailboxString(mailboxString, [preserveGroups])
– [Added in TB 137]
Parse a mailbox string containing one or more email addresses (see RFC 5322, section 3.4).
Parameters
mailboxString
The string to be parsed (e.g. User <user@example.com>, other-user@example.com)
preserveGroups
Keep grouped hierachies. Groups may be specified in a mailbox string as follows: GroupName : user1 <user1@example.com>, user2@example,com ;.
Types
MailboxHeaders
– [Added in TB 137]
MIME headers, which by default are treated as containing one or more mailbox strings.
string
Supported values:
approved
bcc
cc
delivered-to
disposition-notification-to
from
mail-followup-to
mail-reply-to
reply-to
resent-bcc
resent-cc
resent-from
resent-reply-to
resent-sender
resent-to
return-receipt-to
sender
to
ParsedMailbox
– [Added in TB 137]
Representation of a parsed mailbox string (see RFC 5322, section 3.4).
object
The addr-spec associated with the provided address, if available.
group
The members of the group, if available.
name
The display-name associated with the provided address or group, if available.