Skip to main content
Many transactional emails need to include files — invoices after a purchase, receipts for payments, reports generated on demand, or contracts that need a signature. Lettr supports base64-encoded file attachments, so you can attach files directly in your API request.

Basic Attachment

Attach files using base64-encoded content:

Multiple Attachments

Inline Images

Embed images directly in your email HTML:

Attachment Limits

Large attachments can affect deliverability and may be blocked by recipient email servers. Consider using download links for large files.
Not every file belongs as an attachment. Consider which approach fits your use case: Use attachments for: invoices, receipts, tickets, and small documents the recipient needs to keep. Use download links for: large reports, media files, archives, and files that should expire after a set period.

Attachment Format

Attachments are included as base64-encoded content in the API request. Each attachment requires three fields:
  • name — The filename the recipient will see (max 255 characters)
  • data — The file content encoded as base64 (must not contain \r\n characters)
  • type — The MIME type of the file

Error Handling

When an attachment fails validation, the API returns an error and the email is not sent:
Validate file sizes and ensure base64 encoding does not contain \r\n characters before calling the API to avoid failed sends.

Common MIME Types