Skip to main content

Attachments 📎

Want to send a PDF receipt? An image? A spreadsheet? No problem. You can attach basically any file to any email you send through Mailofly.

How it works

Attachments go inside the attachments array in your request. Each file needs a name and its content (encoded in base64 — more on that in a sec). Here’s what each attachment object looks like:

Example: Attaching a PDF invoice


Example: Inline images (embed inside email)

Sometimes you want an image to appear inside the email, not as a separate download. Use disposition: "inline" and give it a content_id, then reference it in your HTML with cid::

Limits to keep in mind

  • 📦 Max email size: 25 MB total — that includes HTML, headers, and all attachments combined.
  • 🚫 Blocked file types: Executables like .exe, .bat, .cmd, .scr, .vbs, .js are rejected automatically. This protects your recipients and keeps spam filters happy.