• Introduction
  • Tutorial
  • User guide
  • SDK
  • REST API
  • Examples
  • File attachments

    Adding file attachments is possible in two ways – by passing the attachment content programmatically through the emailjs.send() call, or by allowing the user to upload a file. The latter is done by creating a form with a file input field, and sending the email via emailjs.sendForm(). To get started with either option first open your template editor, scroll down to the Attachments section, and add an attachment. See below a description of each parameter.

    Attachment type

    Parameter name

    Specifies the name of the input field for the file upload. The input should be of type “file” and be part of the form passed to the sendForm() call.

    Filename

    Specifies the file name of the attachment (e.g. “image.png”).

    Content type

    Specifies the content type of the attachment (e.g. “image/png”).

    Content

    For the attachments of type “inline content”, this field contains the content of the attachment, encoded in Base64. The content supports dynamic variables, so it’s possible to pass content from Javascript. In such case, triple brackets should be used, e.g. {{{content}}}.