Basic Operation/First-time Use

Extract Em! is an add-on/extension for the Mozilla Thunderbird email client application.

This extension extracts attachments from a folder or an entire account. By default, extracted attachments are packaged in one or more .zip files.

Extract ‘Em! can be opened by right-clicking on an account, a folder, or a message in Thunderbird and then selecting the corresponding menu item.

If a folder or message is selected as the “extraction source”, the Quickmenu is displayed. (If a message is selected, the source is the folder in which the message resides -- not the message itself.) The Quickmenu provides the following options:

  • Extract Now: immediately attempts to extract all attachments from the selected folder, omitting subfolders (if present)
  • Extract Now (+ subfolders): immediately attempts to extract all attachments from the selected folder and its subfolders; this option is only available when subfolders are present
  • Let Me Choose: allows for the selective inclusion of specific folders; attachment discovery and extraction occur in separate steps

If an account is selected as the source, then the Let Me Choose view is displayed directly.

Options are also provided to include embeds (inline-attached images) and apply a file-type filter; these items are covered in detail in the Advanced Use section.


The Quickmenu
Advanced Use & Extension Settings

A number of extension settings govern the behavior of Extract ‘Em! during its use; each is described in the following sections, and the default value indicated (checked or selected). Two features which supplement the main extraction process, permanent detachment /deletion and summary report generation, are also described below.

UI Mode

These extension settings provide options for how Extract ‘Em! behaves when it is activated.

The Quickmenu is the default view when Extract ‘Em! is opened with a folder as the source. In addition to the execution buttons (described in the Basic Operation section), options to include embeds (inline-attached images) and apply a file-type filter are also provided.

When this option is assigned in the extension settings, Extract ‘Em! will immediately begin discovery when opened against a folder source and proceed to save the attachments according to the storage option specified in the settings. Further settings specific to this mode are provided:

  • Instructs the extension to query subfolders of the selected folder, if any are present.
  • Performs the extraction process without the UI or user intervention, with the exception of save prompts.

Let Me Choose allows for selectively including specific folders within an account, or subfolders within a folder. Additionally, an Attachment List is provided following the discovery phase allowing for the selective inclusion of specific discovered attachments.

Checkboxes are provided which indicate whether a folder should be queried during discovery; following discovery, those that were included may subsequently be excluded (unchecked) for extraction. Clicking the folder label will toggle the checkboxes for that folder and any subfolders it contains.

As with the Quickmenu, options are provided to include embeds and apply a file-type filter.

Finally, the Extract ‘Em! button initiates the operation to save the attachments according to the storage option specified in the settings.

Discovery

During the discovery phase of extraction, messages in the selected source are queried to identify associated attachments.

Embeds are inline-attached images which are treated separately from traditional attachments as they are considered essential to the message rather than addendums to it; they are optional to include.

Attachments may be selectively included according to file-type (i.e., file extension) through this filtering mechanism. Besides the types listed in the category sections, options are provided for including files of unknown type (lacking an extension) and those with extensions not otherwise listed. Finally, the categories can be extended by adding types which are not already listed. (Embeds are not subject to this filtering.)

Attachments are considered duplicates if they share a common filename and size with another attachment, and these are omitted by default; while this is sufficient in most cases, some scenarios may necessitate non-omission as the file contents are not genuinely identical. When this setting is unchecked, the duplicate attachments are sequentially renamed rather than omitted. (This setting does not apply to embeds as their file contents are more strictly compared by virtue of a checksum.)

Attachment List

Following discovery in Let Me Choose mode, an Attachment List tab appears which presents a detailed list of attachments which have been identified. This list allows for selective inclusion at the individual attachment level. The following settings affect the layout of this list:

  • Default grouping

    Items may be grouped by the selected attribute (message author, Thunderbird folder, file extension), or not grouped.

  • Image preview

    Attachments recognized as images may be previewed as thumbnails; this setting indicates the size of the thumbnail, or to omit the preview. Clicking on a thumbnail displays the image in a larger view (Image Zoom), which may then itself be closed by clicking it. NOTE: previews are not recommended for large sets of attachments as this has a detrimental effect on the usability of the list (e.g., scrolling lags, crashes).

Storage (Save) Options

By default, the attachments included in the extraction operation are packaged (bundled) in .zip archive files which are then saved to the file system. The storage location of these package files is dependent on the Always prompt for save location setting (described immediately below). An upper limit of 750 MB is enforced for the package file contents, so multiple package files may result. Two sub-options are available:

  • If selected, the user is prompted for the save location for each package file produced; otherwise the files are saved to the directory specified in the Thunderbird settings (Files and Attachments section).

  • This option allows for extracted attachments to be stored under folders within the package file following the folder structure of the extraction source; for example, an attachment in a message within the Thunderbird folder Inbox/Friends will likewise be placed under Inbox/Friends in the package file.

Rather than packaging/bundling attachments, the individual files may be saved directly to the file system instead; however, in this case the save directory is restricted to the one assigned in the Thunderbird settings. CAUTION IS ADVISED when using this option; for instance, if the Desktop (Windows) folder is assigned as the target location, and a large number of attachments are in question, the user’s desktop could end up blanketed with files!

There are a couple of other quirks regarding this option:

  • The file modification timestamp is set to the time the file is saved during this process; this is distinct from the packaged files, which inherit the timestamp from the message received date.
  • Windows shortcut files (.url) are prohibited from being saved/downloaded by the Thunderbird API (https://bugzilla.mozilla.org/show_bug.cgi?id=1827115). Therefore, the file extension for such files is modified to .ur_ prior to the file being saved.

The option to employ a filename pattern to replace the original attachment filename is included. An editor is provided to construct the filename pattern using a combination of message/attachment attributes and alphanumeric characters plus the dash, underscore, and space characters. The following attributes are provided:

  • From: the originator of the message; options are Sender (email address), Author (name), and None
  • Date: the date the message was received; the options represent date formats
  • Timestamp: the timestamp of the received message in the format hhmmss
  • Original Filename: the attachment’s filename as it appears in the message; if this item is not at the end of the pattern, the file extension is separated from the filename and placed at the end
  • Subject: the message subject; please note that subject lines may be lengthy and could result in file path lengths which exceed system limitations
At least one attribute must be included in order for the pattern to be considered valid.

Post-Extraction Operations
Permanently Detach

Following successful extraction, an option is provided to permanently remove/delete the extracted attachments (and duplicates) from their source messages. PLEASE USE THIS FEATURE WITH CAUTION; it is a destructive, irreversible operation and is not recommended if a means of recovery is not available. (Embeds are not subject to this operation.)

NOTE: This feature is not currently available for IMAP accounts due to an issue with the Thunderbird API. For further information, please view the associated GitHub discussion.

Generate Report

A summary of the extraction operation (and detachment, when applicable) may be generated once the process has completed. It is presented as an .html document, and the user is prompted for the desired save location.

Troubleshooting

This option outputs detailed execution information to the debugging console; it can be useful when troubleshooting extension issues, particularly when communicating with the developer in that regard.

Screenshots
Select Source
Right-click on an account, a folder, or a message to provide the attachment source, and select the Extract 'Em item from the context menu. (Note: selecting a message sets the containing folder as the source.)
Quickmenu
Select an Extract 'Em! option to immediately extract all attachments in the source, or Let Me Choose for more granular selection.
Immediate Extraction
Attachment discovery and packaging progress are displayed before the user is prompted for destination file details.
Let Me Choose
Specific folders can be included or omitted for attachment discovery.
Attachment List
Specific attachments may be included or omitted. If a folder grouping is selected under the Extract 'Em! options, entire groups may likewise be incuded or omitted.
Image Zoom
For image attachments, click on the preview image to display the item in a zoom window. Click on the zoom window to dismiss.
File-type Filter
File-type filtering allows for selectively including only specific file types (jpg, mp3, etc.)
Filename Pattern
Filename pattern assignment (available in the Extract 'Em! options) allows for renaming the attachment file, incorporating the message author, date/time, etc. in the result filename.
Extension Settings
The default values are displayed.
Acknowledgments

I would like to express my gratitude to the following for their contributions and assistance regarding this project:

  • The developer Deimios, whose Attachment Saver extension provided me with a starting point
  • The zip.js library which provides the current .zip file packaging component (courtesy of gildas-lormeau)
  • The JSZip library which provided the .zip file packaging component through version 1.1.2 of Extract 'Em! (courtesy of Stuart K.)
  • The various contributors offering their translation services
  • The various contributors to the Thunderbird Add-on Developers forum who are prompt and most helpful in responding to inquiries.