> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mailofly.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Embed Images

> How to embed inline images and CID attachments in HTML emails.

# Embed Images

When rendering rich emails with images, you can either host images on a public CDN or embed them directly via Content-ID (`cid:`).

## Method 1: Hosted Images (Recommended)

Host your images on an HTTPS CDN (e.g. AWS S3, Cloudflare R2, Vercel Blob) and link them using standard HTML `<img>` tags:

```html theme={null}
<img src="https://assets.yourcompany.com/logo.png" alt="Company Logo" width="120" />
```

## Method 2: Inline CID Attachments

Attach the image file and assign it a unique `content_id`. You can then reference it directly in your HTML:

```typescript theme={null}
await mailofly.emails.send({
  from: "notifications@yourdomain.com",
  to: ["user@example.com"],
  subject: "Receipt",
  html: `<p>Your receipt:</p><img src="cid:receipt-header" />`,
  attachments: [
    {
      filename: "header.png",
      content: base64Buffer,
      content_id: "receipt-header"
    }
  ]
});
```


## Related topics

- [Attachments](/sending/attachments.md)
- [Tracking](/domains/tracking.md)
- [Broadcast editor](/broadcasts/broadcast-editor.md)
- [Template Editor](/templates/template-editor.md)
- [Introduction](/broadcasts/introduction.md)
