Your mail merging options with Thunderbird

If you use the open source Mozilla Thunderbird email client, you’re probably familiar with its powerful address book features: import and export, online status information for your friends, even synchronization. But one thing that’s not so obvious is how to do a mail merge to your address book contacts. Fortunately, where there’s a will — and some source code — there is a way.

By Nathan Willis

EMAIL

Because Thunderbird is an email program, of course, if you search for some variation of “mail merge” and “Thunderbird” you will turn up a lot of hits for performing a mail-merge-like activity with email: sending individual email messages to a list of recipients, but with each one individually addressed, rather than bulk-addressed in the To: or BCC: fields. Since this is a common task and shares some of the same steps as performing a printed mail merge, it is worth looking into briefly.

There is a Thunderbird extension designed to do exactly this email-merging task: Mail Merge, written by Alexander Bergmann. The Mail Merge extension is compatible with the latest Thunderbird 3.0.* releases, and is cross-platform. It supports two features, dubbed Mass Mail and Personal Mail.

Mass Mail allows you to create a draft email, put your intended recipients in the To:, CC:, and BCC: fields, then automatically split the draft into a set of identical copies with one addressed to each recipient. This is all done without special preparation beforehand; the extension adds a button labeled Mass Mail to the toolbar; you compose your mail as usual, then click on Mass Mail to perform the split.

The Personal Mail feature is far more like a traditional paper mail-merge. You create a message template, with control codes in place of the fields you wish to include, then link the template to a comma-separated-value file (CSV) populated with your intended recipients. The control characters use double braces, and you can define any fields you want — just place their field names in the first line of the CSV. You will probably only use the recipient’s name and email address, so your template might just include {{name}} and {{email_address}}, but you could include other information from your address book in the body of the message if you need to.

SNAIL MAIL MERGING WITH OPENOFFICE.ORG

You can also use your Thunderbird address book as the data source for a mail merge job with the free OpenOffice word processor. Version 3.0 and later include built-in support for reading Thunderbird’s address format; earlier versions may require some additional steps.

“The Address Data Source Wizard.  If your copy of OpenOffice is up-to date, you can select Thunderbird as an option.”

OpenOffice’s mail merge feature builds on the office suite’s “data sources” premise, a lower-level feature that ties into several other areas, including spreadsheets. For mail merging purposes, however, the only reason to care about this fact is that it means there are two methods to connect OpenOffice to your address book.

The preferred method is to add your address book as a “data source” before you even begin writing your mail merge document. You will then be able to access it from any document you choose, and you never have to go through the setup step again. Simply go to the “File” menu, scroll down to “Wizards” and select the “Address Data Source” entry. The wizard that pops up will step you through the process of hooking Thunderbird’s address book in as a reusable data source.

“Thunderbird has at least two address books (possibly more if you manually add them).  You must tell OpenOffice which one to use.”

The first screen sports a list of the supported address book options, including Evolution, Groupwise, LDAP, and others. Select “Thunderbird.” If you have more than one address book in Thunderbird (such as a Personal Address Book kept separately from the email addresses Thunderbird automatically collects), you can select which one you want to work with on the next screen. The last screen will ask you to assign a file name to the newly-created data source; this is so that other OpenOffice modules and macros can access it without explicitly knowing whether Thunderbird or some other format was the origin of the data.

“Finally, you must assign a name to your new Thunderbird-backed data source.  This name will appear as an option when doing a mail merge.”

The file it creates will have the extension .odb, but it is not simply a copy of your address book — it is an XML-based file that lets OpenOffice access your address data and translated into its internal format on-the-fly. That means that whenever you update contacts in Thunderbird, OpenOffice will automatically be able to use the updated changes in a mail merge, with no further action on your part.

With the address book connected as a data source, you can now write the document to be mail-merged. Under the “Tools” menu, choose “Mail Merge Wizard.” The first screen lets you select whether to create the merge on the current document, a new one, or a template. The second screen lets you choose between a printed mail merge or an email merge. The third is where you select the address data to be used for the merge.

 “The Mail Merge Wizard.  Step one is selecting a document type.”

Click on the “Select Different Address List” button. The Thunderbird address book data source will appear as one of the options; highlight it and click OK. [A side note: you will notice here that there is an “Add” button to the right; we will talk about when that is useful below …. ] The remainder of the third screen lets you match fields in your address book to (and tweak the formatting of) the name and address blocks to be used in the document. Screens 4, 5, and 6 let you customize the template used to insert the merged name/address information, including a live preview in the editing window. When the document is formatted to your liking, step 7 merges in the address book data and creates the personalized copies for each recipient.

When you reach the point of connecting your document with the data source to be merged, you will find Thunderbird’s address book neatly listed as an option.”

 “With the address source connected, you can then proceed to set up your document.”

“While working on a merge document, you can pause to edit its contents.  OpenOffice highlights ail-merge fields to distinguish them from regular text.”

TROUBLE SHOOTING AND TRICKS

If you are running OpenOffice on Linux, you might want to double-check its feature set before you begin — for unspecified reasons, the version of the office suite included by the Ubuntu distribution does not include support for Thunderbird in the “Address Data Source” wizard. Fortunately, you can download OpenOffice .deb installation packages from the OpenOffice.org web site; they do support Thunderbird and will run on Ubuntu without any trouble.

If that is not an option, however, you do have an alternative. Remember the mysterious “Add” button in the “Select Address List” dialog mentioned above? Here is where it comes into play. You can export your address book (or a subset of it) from Thunderbird as a CSV, then import it here as an address list. It won’t be updated automatically, but it beats trying to perform a mail merge manually.

Outside of OpenOffice, exporting your address book to a CSV file is your best bet for mail merging from Thunderbird. All office applications support CSV as a format, and while there are a few that support other formats, such as the vCard standard, in most cases Thunderbird does not support the format as an export option.

In fact, the only other export formats Thunderbird 3 (the latest revision) supports are tab-delimited (which is no better than CSV) and LDIF. If you are in dire straits, it never hurts to look for an extension, however, any many users who need vCard import or export swear by the MoreFunctionsForAddressBook extension, which not only adds vCard support, but provides some additional contact info fields as well.

Thunderbird is a great email client, considering that it is free software, cross platform, and highly extensible. So it’s good to know you can integrate it in with important office tasks like mail merging documents as well.

By Nathan Willis

  • Pingback: Links 13/4/2010: KDE 4.5 Schedule, Fedora 13 Beta | Techrights()

  • Bruce Davies

    Great info, thank you.
    However, my problem is that our non-profit community organization has all info in EXCEL. I would like to port it into Thunderbird. Can I export to Open Office and then port to Thunderbird since Open Office reads Thunderbird? We have about 500 in our EXCEL address book. That is a lot of typing.

  • Gei Dub

    Hello Bruce,

    If you are using Excel, just save your spreadsheet as a ‘csv’ file (give it a meaningful name), making sure you use the option to save your column headings as well.

    Then in Thunderbird, Tools,Import…, and use the option for Text files. You will then have to map your column headings to the fields in Thunderbird.

    Once it has finished importing, you will have an address book with the name you used to save from Excel.

    Regards
    Gei

  • Pingback: Mail merges from Thunderbird « 0ddn1x: tricks with *nix()

  • http://www.kilopages.com August

    Thank you for the tip to : Mail Merge, written by Alexander Bergmann. You should also know about Mail Tweak, at
    http://mailtweak.mozdev.org/tweaks.html

    It’s easy to miss that Mail Tweak does mail merge, it’s the “Personalize Mail” feature in a list of 47 other features.

    Mail Tweak’s Personalize Mail appears to have the same two modes of operation that Mail Merge does, splitting a list and reading from a CSV file.

    MTPM also appears to handle different character sets in the message and to be a bit more “robust” than Mail Merge, at least by my interpretation of user comments.

    I hope this helps,
    August

  • http://www.kilopages.com August

    P.S. In addition, Mail Tweak has been around since 2008 and is open source — the discussion group has a great many tweaks to the tweaks.

  • Caroline Ford

    Hi. I am looking for a solution using mail merge – however I think we need an added tool to enhance the standard mail merge. We have MS 2003 Word. As one example – we have Letters to send to Managers for each of their employees ie a manager may have 20 employees. This is easy to do by mail merge. However is there a tool that enables us to:
    1. Merge and send by email with a PDF attached rather than word.
    2. Merge and send by email/PDF to employee – with a secure password to open the attachment.
    3. Merge and send to the Manager in one email ie 20 letters in one email rather than 20 emails.

    Any of the above options would help us. Letters in our company are a nightmare – but as it’s salary data it needs to be secure etc.

    Thank you in advance.

  • Michael Lynne

    Thank you so much! I was at my wits end trying to generate mailing labels from my Thunderbird address book using Open Office. Your detailed step by step made it easy.