Basic Attachment
Attach files using base64-encoded content:Multiple Attachments
Inline Images
To show an attachment inside the body of the email instead of as a separate file, give the image attachment acontent_id and reference it from your HTML with a cid: URL:
content_idonly works on image attachments (atypestarting withimage/).- It can be up to 255 printable ASCII characters, without spaces or angle brackets. Don’t include the
<>brackets you may see in raw MIME headers. - Each inline image in a request needs its own unique
content_id. - Attachments without a
content_idare delivered as regular attachments, as before.
content_id that breaks these rules fails with a 422 validation error on attachments.N.content_id, and the email is not sent.
Over SMTP
When you send over SMTP, embedded images created by your mail library (for example, PHPMailer’saddEmbeddedImage() or Laravel’s $message->embed()) keep their Content-ID, so cid: references in your HTML display inline. You don’t need to change anything.
Hosted Images
You can also host the image at a public URL and reference that URL directly, which keeps the message smaller:Many email clients block remote images by default and ask the recipient to “display images.” An
alt attribute keeps the message readable when the image is blocked.Attachment Limits
Attachments vs. Download Links
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\ncharacters)type— The MIME type of the file
content_id to display it inline — see Inline Images.