How to add attachments in email
In this document, we will explain how to add a single or multiple attachments in your email.
You can add static as well as dynamic attachments to emails
On clicking on the attach button (highlighted below) on the to right corner of the either Email editor, you will see:
-
Upload Files: Allows you to attach files from the system. This then stays as a static attachment in the body of the email and is sent along with the email as an attachment every time it’s triggered.
-
Dynamic Placeholders: Allows you to include dynamic files within the email, when the notification event is triggered. You can use placeholders to specify the:
- Filename - provide a static value like ‘Invoice.pdf’ (if you are testing it manually) or a placeholder like
{{attachment.filename}}
(if your are triggering notification event via API) - File type - provide a static value like ‘application/pdf’ (for pdf) or ‘image/jpg’ (for jpg image) etc. (if you are testing it manually) or a placeholder like
{{attachment.filetype}}
(if your are triggering notification event via API). File type should be MIME type. You can get all the MIME types here - Content - provide the Presigned URL link here using a placeholder like
{{attachment.presigned_url}}
. You can provide a Public URL instead of Presigned URL. You can also provide base64 content, but its not recommended as it will increase your payload size.
- Filename - provide a static value like ‘Invoice.pdf’ (if you are testing it manually) or a placeholder like
Placeholders should be used if the attachment information is dynamic (for instance, a personalized attachment depending on the recipient). Typically such attachments are sent via an API call. To send dynamic attachments in the event payload, make sure that the data
section of the payload has an object called attachment
as shown below.
In the above command:
Ensure to provide the correct filename and filetype for the attachment.
When sending dynamic attachments in the payload, we need to configure the dynamic placeholders as shown below.
How to add multiple attachments?
To add multiple attachments in email, add them in the placeholders as shown below.
- Filename -
{{attachment.0.filename}}
- File Type -
{{attachment.0.filetype}}
- Content -
{{attachment.0.presigned_URL}}