FlaresendDocs

Custom headers

Add your own email headers, within the rules Cloudflare Email Service enforces.

Pass extra headers as an object of name to value:

await flaresend.emails.send({
  from: 'Acme <hello@acme.com>',
  to: 'ada@example.com',
  subject: 'Order 1042 shipped',
  text: 'Your order is on its way.',
  headers: {
    'X-Entity-Ref-ID': 'order-1042',
    'List-Unsubscribe': '<https://acme.com/unsubscribe?u=42>',
  },
});

Rules

Flaresend checks headers before the email is queued, so a bad header fails the request at once instead of failing later in the queue. Every failure is 400 invalid_header, with param set to headers.<name>.

RuleLimit
Header namesLetters, digits and ! # $ % & ' * + . ^ _ ` | ~ -. No spaces or colons.
Header valuesNo line breaks. At most 2,048 bytes.
Headers that don't start with X-At most 20.
All custom headers togetherAt most 16 KB.

Headers you can't set

These are set by Flaresend from the request fields. Setting them in headers is refused, and the error message tells you which field to use instead:

HeaderUse instead
Fromfrom
Toto
Cccc
Bccbcc
Subjectsubject
Reply-ToreplyTo
Date, Message-ID, Content-Type, MIME-VersionSet by Flaresend.

The check ignores case, so subject and SUBJECT are refused too.

Headers Flaresend adds

Broadcasts add List-Unsubscribe and List-Unsubscribe-Post: List-Unsubscribe=One-Click to every email, when the mailer has a TRACKING_SECRET. For transactional email you add these yourself if you need them.

Seeing them later

The headers you sent are returned by Retrieve email content for 30 days after sending.

On this page