SMTP Email Query: How to insert an attachment

Hi, I have generated a PDF from a third-party API which returns me with a render id:

I am trying to put this PDF into the attachment field of a SMTP query:

I also have the base64binary, the file name, and the file type from the API.

I understand there is a bug with SMTP for attachments and I have tried following the solution by using this format in FX mode but all this does is send an email with an attachment that is not in the correct format.

The solution for this bug that I am referencing can be found here:
Send email with attachments fails - App Building - Retool Forum


I was able to get the email to work when I selected a file in a file picker and then referenced that file in the Attachments field of the SMTP query.

However, I would like to complete this without any manual action. Is there a way to dynamically fill in the File Picker component with a local file?

Hey @David57940! I don’t think there’s a way to fill the File Picker with a local file, but if it’s just the Base64 and some strings (e.g. the file name) you’re passing in, could you store that Base64 somewhere else in your retool app (e.g. in a transformer)?

I don't know if this is still an issue but I was able to send a file as an attachment using an SMTP query by storing the info I get from my API Query file in a transformer and passing the transformer's value as the attachment in the SMTP query. Below are a couple screenshots of my queries:

1 Like