New guide: how to warm up a dedicated IP without hurting your reputation. Read now →
Log in
MigoSMTP
SMTP and APIUpdated 4 Nov 2026

Precedence, X-Mailer and User-Agent headers: what they do and whether to set them

What the Precedence, X-Mailer and User-Agent headers mean, which are informational and which affect behaviour, and which headers you should set instead for bulk mail, auto-generated mail and list management.

SM
Written by Sofia Marino
Technical Support Lead
Reviewed by Kwame Mensah
  • Published25 Jul 2023
  • Read time7 min
  • Length1,357 words
Share this guide

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.

PrecedenceInformal hint (bulk, list, junk) used mostly to stop auto-replies and loops. Not a delivery priority
X-Mailer / User-AgentFree text naming the sending software. Informational, easy to change or remove
Effect on inboxingNone that you should rely on; authentication and reputation dominate
Set insteadList-Unsubscribe for marketing, Auto-Submitted for automatic mail

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-Click

Do 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

HeaderRecommendationWhy
Precedence: bulkOptional for bulk streams; harmlessHelps older responders skip the message; no inboxing benefit
Precedence: listUse for real mailing list traffic onlySignals list semantics together with List-Id
Precedence: junkAvoidReads as a negative label and gains you nothing
Auto-Submitted: auto-generatedSet on machine-generated messagesStandards-based loop prevention
X-MailerLeave the library default or omitInformational; avoid misleading or spoofed values
User-AgentSame as X-MailerInformational
X-Priority / ImportanceDo not set on marketingLooks like spam; recipients may react badly
List-Unsubscribe and List-Unsubscribe-PostSet on marketing and subscription mailRequired by major mailbox providers for bulk senders; see List-Unsubscribe
List-IdSet on newsletters and listsIdentifies 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

  1. Send one message from each stream to a mailbox you control and open the raw source.
  2. Confirm each header listed above appears exactly once and its value is the one you intended.
  3. Check that no header contains user-supplied text that has not been stripped of line breaks.
  4. Verify that SPF, DKIM and DMARC pass for the domain in the visible From address, since these outweigh every header in this article.
  5. 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.
  6. Repeat after every change to your mail library, relay or template engine, because upgrades can add or drop default headers.

Troubleshooting

SymptomLikely causeWhat to do
Vacation reply sent to your newsletterNo Precedence or Auto-Submitted on the messageAdd Auto-Submitted and Precedence: bulk; check list headers
Customers do not receive replies from your auto-responderYou labelled a transactional message as bulkRemove Precedence: bulk from messages that expect replies
Messages flagged by an anti-spam rule naming your mailerUnusual X-Mailer stringUse the default value or remove the header
Header appears twiceBoth your app and your relay add itSet it in one place only
Custom header missing in received messageGateway stripped unknown headersCheck relay or gateway rewrite rules
Message rejected for malformed headerLine break or non-ASCII in valueStrip 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.

See the SMTP relay

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.

Topics#headers#precedence#x-mailer#user-agent#bulk email
Was this guide helpful?Your answer helps us improve our documentation.

Start sending in minutes.

Create an account, add your domain and send your first email.

Get started Talk to sales