I was just wondering whether CiviCRM offers the ability to insert custom images into a mass mailing? So that each person receives a different image pulled from a server?

The best described example I can find is here.

In the same vein, can tokens/mail merge be used in CiviCRM to send a different attachment to each subscriber?

If the answer to these questions is yes, can you tell me where the images/attachments are pulled from? I would assume our own server?

Kind regards, G

1 Answer 1


What you're describing is technically possible, but far from streamlined - so whether it's worth doing is up for debate. If it's a feature that's interesting to you, you may want to write (or fund someone to write) an extension to facilitate it.

Let's talk about doing this with custom fields (Administer menu > Customize Data and Screens > Custom Fields) and with an extension.

Custom fields are available as tokens, and they can contain HTML links. So you can create a custom field called, e.g., "image link" on a contact. You can then insert a token in CiviMail - see "Using Tokens in Emails" on this page in the documentation. It will look something like this:

Here's a link to the image: {contact.custom_8}

That's not quite what you want - you want to embed the image into the mail itself. So instead, do:

Here's your image: <img src="{contact.custom_8}">

Note that you'll need to go into "HTML Source" mode on your mail to enter that.

You can store the images wherever you like.

Now, this is unwieldy, because you have to populate the custom field for every user who receives the mailing.

If you went the extension route, you would use civicrm_hook_tokens and civicrm_hook_tokenValues to create your own tokens. You could then make tokens that created images based on, say, someone's interests or any other data you already stored. There's a good article here if you want to go that route, or check out the excellent Fancy Tokens extension for a solution to a related problem.

  • Jon, thanks for the reply. I'm working in a school that has students and sponsors. We're looking for a solution that allows us to email 2,000 people, with each person receiving an image and pdf attachment of their own sponsored child. Currently, we're doing this manually. We've tested Campaign Monitor, and it is possible to use custom fields to create emails that have personalized images and the correct report for their child. CM's cost is prohibitive, and we're moving to CiviCRM anyway, so I was hoping it would provide similar functionality.
    – user2857
    Feb 26, 2016 at 13:03
  • 1
    @Telcon - since you want to have an different hand-picked image per contact anyway, the first approach I gave you is actually no less work than you would need to do this anyway. You should be good to go with no customization! Feb 26, 2016 at 20:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.