Tokens and Mail Merge

You can use data in your CiviCRM database to set up mail merge communications both for emails and printed materials such as letters and mailing labels.  The mail merging functionality relies on Tokens which represent items in your database. This chapter explains how tokens work and how to use them in generating printing materials. Using tokens in emails and mass mailings is covered in the Email section.


Tokens perform the equivalent of mail merge in CiviCRM. This means that it is possible to insert information from the database into an email or a letter that is different for every recipient.  Tokens are accessible via the Insert Token link in the top right corner of the message editing area.

Most of the tokens contain information that is in the database fields. However, there are some special tokens that accomplish specific tasks such as a link to an optout page or link to choose mail formats. Some tokens are only available for mass mailings such as the token to provide a link to a message stored online.

Only contact fields and actions can be inserted in your email as tokens. Related records, such as the name of the event for which the contacts have pending enrollments, cannot be included. However, in emails, you could provide a link to the person's contact dashboard so that they can review their registration details for themselves (once logged in). In emails, you can also use a checksum token that generates a unique URL for each contact so they can modify their information without having to login.

See here for details on using Checksums:

It is also possible to have custom tokens created by a developer. For instance, the total amount of contributions from a contact. To find out more about working with custom tokens, refer to the discussion about custom mail merge tokens in the Hooks chapter of the Extending CiviCRM section of this book and look at the wiki:

Another task for a developer is to create if/then logic for your mail merge. This is done using the smarty template language as described here

Postal Mail Communications

This chapter discusses the different ways that CiviCRM helps with postal mail and post mail campaigns. It will help if you already have a strong understanding of CiviCRM's search features as well as custom fields, activities, profiles, and how to perform mail merges using word processing software.

Planning Your Mailing

Before beginning any communication activity, take the time to identify your goals and plan the steps. For our purposes, there are a few key questions to ask before sending out postal mailings.

  • What types of mailing do you send out to your constituents?
  • Are mailings always sent to everyone in the database or are they frequently targeted to a select group of contacts?
  • How do you want to greet recipients (e.g. "Dear Jane" or "Dear Jane Doe")?

There are three ways that you can use CiviCRM in postal mailings:

  1. Generate labels: print out standard address labels when you don't need to personalise the content, for instance to send a printed brochure.
  2. Export contacts and do a mail merge to an external tool (such as OpenOffice or Microsoft Word). Refer to the chapter on Exporting in the Getting Around section.
  3. Generate PDF letters and do the merge directly in CiviCRM.

Many nonprofit organisations in the USA need to sort recipients of a mailing based on zip code for bulk mailing purposes. If this is true for your organisation, it is recommended that you create your mailing labels using a word processor where you can control the sort order, rather than in CiviCRM. You can reuse the same spreadsheet for your mail merge.

Greetings and salutations

You can set a specific postal greeting format for each contact. There are several options from the friendly "Dear John", to more formal "Dear Mr. John Doe". You can also enter a customized greeting ("Your royal highness"). Postal greetings can be edited in the Communications Preferences section of the contact edit form. If you need to set or reset postal greetings en mass, refer to the Command Line Script Configuration documentation:

Print PDF letters

The workflow is to first select the group you want to target, then choose the action "Print PDF letter" from the dropdown menu. The letters will then be outputted as a PDF, allowing you to easily print them.

To create the letter:

  1. Go to Search > Find Contacts or Find Contacts > Advanced Search.
  2. Enter your search criteria and click Search.
  3. Select the contacts who will receive the letter.
  4. From the Actions dropdown menu, choose "Print PDF Letter for Contacts" and click Go.
  5. Create your letter, using the formatting options provided. You can personalise the letter by using tokens, for example Postal Greeting is a commonly used token in this situation. Click in the body of the letter where you want to enter the token. Then click on "Insert Tokens" located above the letter at the top right and select the desired token.
  6. Before you move to the next screen, decide whether the format of this letter could be used again. If so, check the Save New Template box and enter the Template Title.
  7. When your letter is finished scroll to the bottom and click Make PDF Letters.
  8. A pop-up window will offer the option of opening or saving the PDF. Open and review your letter and then print it, or save the PDF and review at your leisure.


You can use this feature for any kind of document, not only letters. For example, you could use it to print attendance certificates for a workshop.

Generate mailing labels

Generating mailing labels is a very easy and useful function.

  1. Perform the search to select the contacts you want to target.
  2. Choose Mailing Labels from the Actions dropdown menu and click Go.
  3. Select the mailing label style
  4. Determine if you want to exclude people with "do not mail" checked in their privacy options (checked by default and recommended), and whether you want to merge any records with the same mailing address into one label.

This last option is very useful when sending a mailing to a households or organisations where you don't want them to receive duplicate mailings. When the records are merged, each name at that address is listed on a separate line on the label.

Your system administrator can configure the fields included in mailing labels. Read the information on configuring address settings in the Contacts chapter to learn more about the options.

Il y a une erreur de communication avec le serveur Booktype. Nous ne savons pas actuellement où est le problème.

Vous devriez rafraîchir la page.