# Attach a different file to each email sent with Mautic

**URL:** <https://forum.mautic.org/t/attach-a-different-file-to-each-email-sent-with-mautic/32609>\
**Category:** Product Support\
**Created:** [July 1, 2024, 10:51am UTC](https://forum.mautic.org/t/attach-a-different-file-to-each-email-sent-with-mautic/32609 "2024-07-01T10:51:41Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![NetVicious](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/netvicious/32/12260_2.png) [@NetVicious](https://forum.mautic.org/u/NetVicious)\
**Post date:** [July 1, 2024, 10:51am UTC](https://forum.mautic.org/t/attach-a-different-file-to-each-email-sent-with-mautic/32609/1 "2024-07-01T10:51:42Z")

</div>

Hi!

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 ?

Regards,

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [July 2, 2024, 3:28pm UTC](https://forum.mautic.org/t/attach-a-different-file-to-each-email-sent-with-mautic/32609/2 "2024-07-02T15:28:09Z")

</div>

Hello!

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.

Joey

---

<div class="post-metadata">

**Author:** ![NetVicious](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/netvicious/32/12260_2.png) [@NetVicious](https://forum.mautic.org/u/NetVicious)\
**Post date:** [July 5, 2024, 10:47am UTC](https://forum.mautic.org/t/attach-a-different-file-to-each-email-sent-with-mautic/32609/3 "2024-07-05T10:47:29Z")

</div>

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”

---

<div class="post-metadata">

**Author:** ![rcarabelli](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/rcarabelli/32/6807_2.png) [@rcarabelli](https://forum.mautic.org/u/rcarabelli)\
**Post date:** [July 5, 2024, 9:24pm UTC](https://forum.mautic.org/t/attach-a-different-file-to-each-email-sent-with-mautic/32609/4 "2024-07-05T21:24:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![NetVicious](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/netvicious/32/12260_2.png) [@NetVicious](https://forum.mautic.org/u/NetVicious)\
**Post date:** [July 12, 2024, 10:48am UTC](https://forum.mautic.org/t/attach-a-different-file-to-each-email-sent-with-mautic/32609/5 "2024-07-12T10:48:08Z")

</div>

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.

Regards,

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [July 15, 2024, 1:05am UTC](https://forum.mautic.org/t/attach-a-different-file-to-each-email-sent-with-mautic/32609/6 "2024-07-15T01:05:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![NetVicious](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/netvicious/32/12260_2.png) [@NetVicious](https://forum.mautic.org/u/NetVicious)\
**Post date:** [July 15, 2024, 7:58am UTC](https://forum.mautic.org/t/attach-a-different-file-to-each-email-sent-with-mautic/32609/7 "2024-07-15T07:58:18Z")

</div>

Hi! The php receives a GET parameter like [http://myserver/myphp.php?qrcodecontent=This\_its\_the\_content\_of\_the\_QR](http://myserver/myphp.php?qrcodecontent=This_its_the_content_of_the_QR)

The php works perfectly.

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [July 15, 2024, 12:00pm UTC](https://forum.mautic.org/t/attach-a-different-file-to-each-email-sent-with-mautic/32609/8 "2024-07-15T12:00:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![NetVicious](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/netvicious/32/12260_2.png) [@NetVicious](https://forum.mautic.org/u/NetVicious)\
**Post date:** [July 22, 2024, 7:01am UTC](https://forum.mautic.org/t/attach-a-different-file-to-each-email-sent-with-mautic/32609/9 "2024-07-22T07:01:07Z")

</div>

Dynamic needs to upload one asset per QR and send the emails within mautic vía API one by one ?
