Attach a different file to each email sent with Mautic


I’m trying to send a batch of emails using a Segment and some contacts.
I created an email template and all works correctly.

But I want to create another segment on which I can add a different attachment to each contact. It’s a QR code I want to embed inside the email instead of creating a link pointing to a website which should create the QR.

I tried to use <img src with base64 using a custom field with the base64 on each contact but it doesn’t works on GMail.

Any tip about how to do this kind of sendings ?



The only way to do this is:

  1. add Asset (attachment) programatically via API
  2. send email programatically via API, where you are also attaching the asset ID you just created.


Ok, got what you mean, but we’re looking for an easy way.

I’m trying now with remote assets, but it seems the remote assets doesn’t allow/replace custom fields vars on it’s “Remote URL”

The QRs (or file, or image) will be made on demand, each time a message is created or you have like a QR database.

I made a PHP file which accepts a GET parameter which should be the text of the QR. The PHP file returns a PNG file with the QR.

We added a custom field to the contact with the QR code. The PHP file gets that code and will generate the QR image for that contact. We want to embed that PNG inside the email, instead of making the QR generator php file and place a link inside the email to that php file.


Hi, the php file can return an image based on a parameter it holds. Would that work?

Hi! The php receives a GET parameter like http://myserver/myphp.php?qrcodecontent=This_its_the_content_of_the_QR

The php works perfectly.

You cannot embed this, you need to make it dynamic in my opinion.