Reference
SMTP headers and replies
Which headers Emailit adds, rewrites or removes on SMTP mail, how to read email IDs from the 250 reply, and how to add List-Unsubscribe yourself.
Emailit relays the MIME message you submit over SMTP mostly as it is, but it changes a few headers so the message authenticates and can be tracked. This page lists those changes, explains the 250 reply that carries the new email IDs, and covers the headers you have to add yourself.
Headers Emailit adds or rewrites
| Header | What Emailit does |
|---|---|
Received |
Adds trace headers for the relay and for the Emailit mail server that delivers the message. |
Message-ID |
Replaces yours with <token@your-domain>, where the domain is the one in your From address. Each recipient’s copy gets its own Message-ID. |
Date |
Sets it when Emailit first processes the message for delivery. |
Subject |
Rewrites it from the decoded subject and re-encodes non-ASCII characters. |
Return-Path |
Sets a bounce address on your return-path subdomain, emailit.<your-domain>. The same address is used as the envelope sender, so SPF passes for your domain. |
X-Emailit-ID |
Adds the email’s token. |
Feedback-ID |
Adds an identifier that mailbox providers use in complaint reports. |
DKIM-Signature |
Signs the message with your domain’s DKIM key (selector emailit by default). A second signature for emailitmail.com can be added for complaint feedback loops. |
The DKIM signature covers the From, To, Cc, Subject, Date, Message-ID, Reply-To, MIME and List-* headers, among others. Don’t change a message after Emailit has signed it, for example with a mailing list that rewrites the subject, or the signature fails.
Headers Emailit removes
| Header | When |
|---|---|
Bcc |
Always, so Bcc recipients stay hidden. |
Reply-To |
When it names the same address as From. Some spam filters penalize a redundant Reply-To. |
Content-Disposition |
At the top level of the message. Attachment parts keep theirs. |
Everything else, including your own X- headers, is delivered unchanged.
Control headers aren’t read over SMTP
Don’t include an X-Emailit-ID header in messages you submit. Emailit uses it to recognize messages it has already processed, and a message that has one skips the header rewriting and DKIM signing described above.
The 250 reply
When the relay accepts a message, its reply to the end of DATA lists the Emailit email IDs it created, one per recipient:
250 2.0.0 OK: queued as em_33VtK8mRq1xZp7LwN4cY2bHsDfa, em_33VtK8nB5rTq0YxW3mJk9PdLsUe2.0.0is the enhanced status code for success.- Each
em_ID is the same ID that the API, the dashboard and webhooks use for that recipient’s email. - The reply line has a length limit. If all the IDs don’t fit, which happens at around 15 recipients, the reply contains only the first ID. Find the others in Email APIEmails or from webhook events.
Most libraries expose the reply. In Nodemailer it’s info.response. In PHPMailer, call $mail->getSMTPInstance()->getLastReply() after send(). Save the ID next to your own record, so you can match webhook events or look the email up later with Retrieve an email.
Add List-Unsubscribe yourself
Emailit adds List-Unsubscribe headers only to campaign emails. If you send newsletters or other bulk mail over SMTP, add both headers to the message yourself:
List-Unsubscribe: <https://acme.com/unsubscribe?u=881&l=digest>, <mailto:unsubscribe@acme.com?subject=unsubscribe-881>
List-Unsubscribe-Post: List-Unsubscribe=One-ClickThe https URL must accept a POST with the body List-Unsubscribe=One-Click and unsubscribe the person without a confirmation step (RFC 8058). Emailit includes both headers in the DKIM signature, which Gmail and Yahoo require for one-click unsubscribe.
await transporter.sendMail({
from: 'Acme <news@acme.com>',
to: 'ada@example.com',
subject: 'Acme weekly digest',
html: '<p>This week at Acme…</p>',
headers: {
'List-Unsubscribe': '<https://acme.com/unsubscribe?u=881&l=digest>',
'List-Unsubscribe-Post': 'List-Unsubscribe=One-Click',
},
});msg["List-Unsubscribe"] = "<https://acme.com/unsubscribe?u=881&l=digest>"
msg["List-Unsubscribe-Post"] = "List-Unsubscribe=One-Click"$mail->addCustomHeader('List-Unsubscribe', '<https://acme.com/unsubscribe?u=881&l=digest>');
$mail->addCustomHeader('List-Unsubscribe-Post', 'List-Unsubscribe=One-Click');