Attaching multiple documents in a single email-Input binary not supported on emails
Application Type

Good day. I would like to attach multiple statements in an email. If its 1 file i will attach 1 pdf, if they are more than 2 then a zip file. I understand the logic but to implement that on my email i want to pass an input parameter of a file (PDF) in binary form and a zip if the documents are in a zip. My challenge now is on emails it does not support binary as data type so i am stuck. Any ideas to get around it.

Rank: #70


My suggestion would be to store them in the database with a given GUID (unique identifier), use the GUID to pass the context to email, fetch the emails by GUID and delete them after. Something like this:

1. Create a table TempBinaryTable, with a GUID and Binary Data;
2. Save the binaries in a table with the same GUID if they are for the same email;
3. Have the GUID as an input of your email;
4. On the Preparation of your email, get the binaries from TempTable, attach them to the email and remove them from the Database.

To generate the GUIDs, I'd use the GenerateGuid function from System:



Rank: #70


In order to send emails with attachments, you will have to attach them on Preparation, using Attach File :

You would have to create the zip in the Preparation and attach it using the action as shown above.

More information on attaching documents in emails here.

Hope it helps.



Rank: #95

Hello Rudo,

Hope you're doing well.

If you want to pass a structure to your e-mail without storing it in the database, you may consider to use a JSON (text) for that scenario.

Basically, your e-mail just needs to receive a Text as an input parameter, which is the corresponding JSON for your structure:

This text is the result of the JSON Serialize widget, which basically is going to serialize your Structure in its corresponding JSON:

Like mentioned before, you can pass this serialized JSON (Text) to your e-mail as an input parameter:

In your e-mail's Preparation, you just need to deserialize your JSON (Text) back to your Structure's data type, using JSON Deserialize:

After this deserialization, you will be able to use the output directly or you can assign the output to a local variable of your structure's data type and use it afterwards:

However, since you are working with binaries, I'd suggest that you consider to store these files in the database and fetch them in your e-mail's Preparation.

Hope that this helps you!

Kind regards,

Rui Barradas