Skip to main content
There are two ways to send attachments:
  1. From a remote file
  2. From a local file
We currently do not support sending attachments when using our batch endpoint.

Send attachments from a remote file

Include the path parameter to send attachments from a remote file. This parameter accepts a URL to the file you want to attach. Define the file name that will be attached using the filename parameter.

Send attachments from a local file

Include the content parameter to send attachments from a local file. This parameter accepts the Base64 encoded content of the file you want to attach. Define the file name that will be attached using the filename parameter.

Embed Images using CID

You can optionally embed an image in the HTML body of the email. Both remote and local attachments are supported. All attachment requirements, options, and limitations apply to embedded inline images as well. Embedding images requires two steps: 1. Add the CID in the email HTML. Use the prefix cid: to reference the ID in the src attribute of an image tag in the HTML body of the email.
2. Reference the CID in the attachment The content id is an arbitrary string set by you, and must be less than 128 characters.
Learn more about embedding images.

View and Download Attachments

You can view and download attachments from sent emails from the dashboard or programmatically through the Attachments API.

From the dashboard

  1. Go to Emails.
  2. Navigate to any email you sent with an attachment.
  3. Click on the attachment to download it locally.
Attachments include the filename and an icon to help you identify the type of attachment. Each attachment type has a unique icon:
  • Image
  • PDF
  • Spreadsheet
  • Default (for unknown types)

From the API

Use List Attachments to fetch all attachments for a sent email, or Retrieve Attachment to fetch a single one. Both endpoints return a signed download_url that you can use to download the content.

Attachment Limitations

  • Emails can be no larger than 40MB (including attachments after Base64 encoding).
  • Not all file types are supported. See the list of unsupported file types.
  • Emails with attachments cannot be sent using our batching endpoint.

Examples

Attachments

Next.js (TypeScript)

See the full source code.

Next.js (JavaScript)

See the full source code.

PHP

See the full source code.

Laravel

See the full source code.

Python

See the full source code.

Ruby

See the full source code.

Inline Images (CID)

Next.js (TypeScript)

See the full source code.

Next.js (JavaScript)

See the full source code.

PHP

See the full source code.

Laravel

See the full source code.

Python

See the full source code.

Ruby

See the full source code.