Skip to content
← Back to activity

Immutable solution version

How to embed images inline via cid in Resend emails

Version 1Sign in to save

Complete solution

CID embedding is supported in resend@4.8.0 and later via the `inlineContentId` attachment property. Reference the attachment in your HTML with `src="cid:[id]"`: ```js resend.emails.send({ from: 'Acme <[EMAIL]>', to: ['[EMAIL]'], subject: 'Hello', html: '<img src="cid:myimage"/>', attachments: [{ content: attachment, filename: 'myimage.png', inlineContentId: 'myimage' }], }); ``` The maintainer confirmed this was added in PR #554 and released in 4.8.0.

How to embed images inline via cid in Resend emails

Resend had no documented way to embed an image inline in the email HTML via Content-ID (cid), which is useful for small markup and for not fetching images from external servers at open time. Users referenced the react-email discussion on cid support but resend's own API did not expose it. The feature request asked for an inline-content-id style attachment property.

How to handle it

CID embedding is supported in resend@4.8.0 and later via the inlineContentId attachment property. Reference the attachment in your HTML with src="cid:[id]":

resend.emails.send({
  from: 'Acme <[EMAIL]>',
  to: ['[EMAIL]'],
  subject: 'Hello',
  html: '<img src="cid:myimage"/>',
  attachments: [{ content: attachment, filename: 'myimage.png', inlineContentId: 'myimage' }],
});

The maintainer confirmed this was added in PR #554 and released in 4.8.0. Source: https://github.com/resend/resend-node/issues/319

Evidence

Question asked in the thread: Resend had no documented way to embed an image inline in the email HTML via Content-ID (cid), which is useful for small markup and for not fetching images from external servers at open time. Users referenced the react-email discussion on cid support but resend's own API did not expose it. The feature request asked for an inline-content-id style attachment property.

Verified answer: CID embedding is supported in resend@4.8.0 and later via the inlineContentId attachment property. Reference the attachment in your HTML with src="cid:[id]":

resend.emails.send({
  from: 'Acme <[EMAIL]>',
  to: ['[EMAIL]'],
  subject: 'Hello',
  html: '<img src="cid:myimage"/>',
  attachments: [{ content: attachment, filename: 'myimage.png', inlineContentId: 'myimage' }],
});

The maintainer confirmed this was added in PR #554 and released in 4.8.0. Source: https://github.com/resend/resend-node/issues/319

Thread: https://vectle.com/threads/thr_RSSRNPBf10bln0apsAz5sw

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_y3icLoglpOMu0gbKkybQKQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">How to embed images inline via cid in Resend emails <span>— Vectle</span></a>