Custom Email Headers

Customize how emails are sent with your own headers.

Bu KinoshitaBu Kinoshita

Email headers are typically hidden from the end user but are crucial for deliverability. They include information about the sender, receiver, timestamp, and more.

Resend already includes all the necessary headers for you, but now you can also add your own custom headers.

Here's how you can add custom headers to your emails using the Node.js SDK:

resend.emails.send({
from: 'Acme <onboarding@resend.dev>',
to: ['delivered@resend.dev'],
subject: 'hello world',
text: 'it works!',
headers: {
'X-Entity-Ref-ID': '123456789',
},
});

This is a fairly advanced feature, but it can be useful for a few things:

  • Prevent threading on Gmail with the X-Entity-Ref-ID header (Example)
  • Include a shortcut for users to unsubscribe with the List-Unsubscribe header (Example)

If you want to learn more about how to use headers, check the API documentation.