Precedence, X-Mailer and User-Agent are optional, non-authenticated headers. None of them is required for delivery and none will improve your inbox placement. Precedence: bulk (or list, junk) is an old convention that tells some mailing list and auto-reply software not to answer the message. X-Mailer and User-Agent simply name the software that generated the message. For modern bulk mail the headers that matter are different: List-Unsubscribe, List-Id and, for machine-generated mail, Auto-Submitted.
This article explains what each of these three headers is for, where they came from, what mailbox providers can infer from them, and a sensible default policy for developers who build mail into applications.
What the Precedence header is
Precedence is not defined in the core message format (RFC 5322). It appears in older mail practice and is described in RFC 2076, an informational document listing common headers. Typical values are bulk, list and junk. Despite the name, it does not set a priority and it does not make routers deliver mail faster or slower. Its practical use is as a signal to other software, for example a vacation responder that should not answer a message marked as bulk, so that two automatic systems do not trade replies forever.
Precedence: bulk
Auto-Submitted: auto-generated
List-Id: <newsletter.example.com>
List-Unsubscribe: <https://example.com/u/abc123>, <mailto:[email protected]?subject=unsubscribe>
List-Unsubscribe-Post: List-Unsubscribe=One-ClickDo not confuse it with X-Priority or Importance, which affect how a mail client flags a message to the reader. Marking promotional mail as high importance is a poor idea: it gives the recipient a reason to complain and is a classic spam pattern.
Auto-Submitted is the modern replacement for loop prevention
RFC 3834 defines Auto-Submitted precisely for automatically generated mail. A value of auto-generated tells responders not to reply, and auto-replied marks a vacation answer. If your application sends notifications, receipts or alerts, this header is the standards-based way to prevent loops. Read auto-replies and mail loops for detail. Many senders include both Auto-Submitted and a legacy Precedence for older software, which is harmless.
What X-Mailer and User-Agent are
Both are free-text fields added by the program that composed or sent the message, for example a desktop client, a script library or a marketing platform. By convention X-Mailer comes from older software and User-Agent from others, but neither is a mandatory field in the standard. Their only function is diagnostic: they help an administrator tell which application produced a malformed message.
X-Mailer: ExampleMailer 2.4
User-Agent: ExampleApp/1.7 (+https://example.com)Because they are not authenticated, anyone can write anything. A recipient system cannot trust them for security decisions, but it can still use them as a weak signal. Spam filters have historically included rules for strings associated with known abusive mass-mailing tools, so an unusual or obviously automated value in a flood of messages can add a small amount of suspicion. A well-authenticated sender with good engagement is not penalised for an ordinary library name. The reverse also holds: renaming your mailer does not hide poor reputation.
Should you set, change or remove them
| Header | Recommendation | Why |
|---|---|---|
| Precedence: bulk | Optional for bulk streams; harmless | Helps older responders skip the message; no inboxing benefit |
| Precedence: list | Use for real mailing list traffic only | Signals list semantics together with List-Id |
| Precedence: junk | Avoid | Reads as a negative label and gains you nothing |
| Auto-Submitted: auto-generated | Set on machine-generated messages | Standards-based loop prevention |
| X-Mailer | Leave the library default or omit | Informational; avoid misleading or spoofed values |
| User-Agent | Same as X-Mailer | Informational |
| X-Priority / Importance | Do not set on marketing | Looks like spam; recipients may react badly |
| List-Unsubscribe and List-Unsubscribe-Post | Set on marketing and subscription mail | Required by major mailbox providers for bulk senders; see List-Unsubscribe |
| List-Id | Set on newsletters and lists | Identifies the stream. See List-Id |
How to set headers in code
Most libraries let you add arbitrary headers. Keep values as constants, never composed from user input without stripping line breaks, because that opens header injection (header injection). Example in Node.js with Nodemailer:
const nodemailer = require('nodemailer');
const transport = nodemailer.createTransport({
host: 'smtp.migosmtp.com',
port: 587,
secure: false, // STARTTLS on 587
auth: { user: process.env.SMTP_USER, pass: process.env.SMTP_PASS }
});
await transport.sendMail({
from: 'News <[email protected]>',
to: '[email protected]',
subject: 'Your weekly update',
html: '<p>Hello</p>',
headers: {
'Precedence': 'bulk',
'Auto-Submitted': 'auto-generated',
'List-Id': '<weekly.example.com>',
'List-Unsubscribe': '<https://example.com/u/abc123>',
'List-Unsubscribe-Post': 'List-Unsubscribe=One-Click'
}
});In Python's standard library the equivalent is simply msg['Precedence'] = 'bulk' on an EmailMessage. If your library adds an X-Mailer by default and you want to omit it, check its documentation for an option; otherwise leaving it is fine. Note that a transactional email, such as a password reset a person has just requested, is not bulk mail. Do not label it Precedence: bulk, because a responder might then suppress a reply that the user actually expects.
What providers actually evaluate
Gmail, Yahoo, Microsoft and others decide placement mostly on sender authentication, domain and IP reputation, complaint rate, engagement and content. Headers such as the three covered here are tiny inputs at best. The headers providers explicitly ask bulk senders for are the list-management ones and valid authentication. See the bulk sender requirements for the current published expectations, and check the providers' own documentation, since these rules change.
Separating bulk and transactional streams
The label you put on a message should match what it is. A practical layout uses two streams, each with its own sending subdomain and header template. The marketing stream carries List-Id, List-Unsubscribe, List-Unsubscribe-Post and optionally Precedence: bulk. The transactional stream, such as receipts, security alerts and password resets, carries Auto-Submitted: auto-generated only when no reply is expected, and no list headers, because a person does not unsubscribe from a receipt for a purchase they just made.
Separate streams also protect reputation: a spike in complaints on promotional mail should not drag down the delivery of a login code. For the reasoning behind subdomain separation see sending subdomain strategy.
An audit checklist for your outgoing headers
- Send one message from each stream to a mailbox you control and open the raw source.
- Confirm each header listed above appears exactly once and its value is the one you intended.
- Check that no header contains user-supplied text that has not been stripped of line breaks.
- Verify that SPF, DKIM and DMARC pass for the domain in the visible From address, since these outweigh every header in this article.
- Search the headers for leftover test values, internal hostnames and private IP addresses that your platform may leak, and remove what you do not need.
- Repeat after every change to your mail library, relay or template engine, because upgrades can add or drop default headers.
Troubleshooting
| Symptom | Likely cause | What to do |
|---|---|---|
| Vacation reply sent to your newsletter | No Precedence or Auto-Submitted on the message | Add Auto-Submitted and Precedence: bulk; check list headers |
| Customers do not receive replies from your auto-responder | You labelled a transactional message as bulk | Remove Precedence: bulk from messages that expect replies |
| Messages flagged by an anti-spam rule naming your mailer | Unusual X-Mailer string | Use the default value or remove the header |
| Header appears twice | Both your app and your relay add it | Set it in one place only |
| Custom header missing in received message | Gateway stripped unknown headers | Check relay or gateway rewrite rules |
| Message rejected for malformed header | Line break or non-ASCII in value | Strip control characters and encode per RFC 2047 where needed |
To verify what a recipient sees, send a test message and read the raw source. Our guide on reading headers shows how.
Summary and next steps
- Do not expect Precedence, X-Mailer or User-Agent to move you into the inbox.
- Use Auto-Submitted for automatic mail and List-Unsubscribe plus List-Id for bulk streams.
- Leave the mailer header at your library default and never spoof it.
- Never label transactional mail as bulk.
- Keep header values constant or sanitised.
Send with correct headers from day one Relay your application mail over authenticated SMTP and add the list headers you need.
References and further reading
Frequently asked questions
Does Precedence: bulk improve deliverability?
No. It is a hint for auto-reply software and has no reliable effect on inbox placement.
What is the difference between X-Mailer and User-Agent?
Both name the sending software. They are informational, unauthenticated and interchangeable in practice.
Should I remove the X-Mailer header?
It is optional. Leaving your library default is fine; just do not spoof another product.
Which header prevents auto-reply loops?
Auto-Submitted, defined in RFC 3834, is the standards-based header for automatically generated messages.
Is Precedence the same as email priority?
No. Importance and X-Priority flag messages for the reader, while Precedence is a bulk or list hint for software.