Questions tagged [email-headers]

E-mail headers are the headers at the beginning of an e-mail that define various properties (e.g. `From` or `Reply-To`) of the e-mail.

In an e-mail, the body (content text) is always preceded by header lines that identify particular routing information of the message, including the sender, recipient, date and subject. Some headers are mandatory, such as the FROM, TO and DATE headers. Others are optional, but very commonly used, such as SUBJECT and CC. Other headers include the sending time stamps and the receiving time stamps of all mail transfer agents that have received and sent the message. In other words, any time a message is transferred from one user to another (i.e. when it is sent or forwarded), the message is date/time stamped by a mail transfer agent (MTA) - a computer program or software agent that facilitates the transfer of email message from one computer to another. This date/time stamp, like FROM, TO, and SUBJECT, becomes one of the many headers that precede the body of an email.

Characteristics

A single email header has some important characteristics, including perhaps the most important part of an email - this is the KEY:VALUE pairs contained in the header. Looking at the above, you can tell some of the KEY:VALUE pairs used. Here is a breakdown of the most commonly used and viewed headers, and their values:

  • From: sender's name and email address (IP address here also, but hidden)
  • To: recipient's name and email address
  • Date: sent date/time of the email
  • Subject: whatever text the sender entered in the Subject heading before sending

Routing

Email headers also provide information on the route an email takes as it is transferred from one computer to another. As mentioned earlier, mail transfer agents (MTA) facilitate email transfers. When an email is sent from one computer to another it travels through a MTA. Each time an email is sent or forwarded by the MTA, it is stamped with a date, time and recipient. This is why some emails, if they have had several destinations, may have several RECEIVED headers: there have been multiple recipients since the origination of the email. In a way it is much like the same way the post office would route a letter: every time the letter passes through a post office on its route, or if it is forwarded on, it will receive a stamp. In this case the stamp is an email header.

List of Email Header Fields

IANI maintains a list of email headers here.

405 questions
142
votes
5 answers

Should I use the Reply-To header when sending emails as a service to others?

Suppose we have an application that acts as a middleman, allowing Company A to send reports to their customers. Company A --> Company B (me)--> Company A's customers After getting the report we send email notifications to the recipients, but they…
Gavin
  • 9,855
  • 7
  • 49
  • 61
57
votes
9 answers

Python - email header decoding UTF-8

is there any Python module which helps to decode the various forms of encoded mail headers, mainly Subject, to simple - say - UTF-8 strings? Here are example Subject headers from mail files that I have: Subject: [ 201105311136…
Hans Moser
  • 571
  • 1
  • 4
  • 4
57
votes
3 answers

Email from PHP has broken Subject header encoding

My PHP script sends email to users and when the email arrives to their mailboxes, the subject line ($subject) has characters like a^£ added to the end of my subject text. This is obviously and encoding problem. The email message content itself is…
daza166
  • 3,543
  • 10
  • 35
  • 41
39
votes
3 answers

How to format an email 'From' header that contains a comma

The standard way to format the 'From' email header is From: John Doe But what to do if there's a comma in the name? From: John Doe, chief bottle washer If I do that, my MTA automatically converts…
Dalin
  • 3,012
  • 1
  • 21
  • 21
34
votes
7 answers

Detecting Outlook autoreply/out-of-office emails

Been googling for this and haven't found anything ... Does anybody know if there is a way, given an Outlook email item, to detect whether it was sent by the "Out Of Office Assistant"? Is there any property that Outlook sets on the object, or any…
jean
  • 1,027
  • 1
  • 8
  • 15
30
votes
6 answers

Change the sender name php mail instead of sitename@hostname.com

I am trying to send email from my php : $to = 'it@7sisters.in'; $email_from = "info@7sisters.in"; $full_name = 'Suraj Hazarika'; $from_mail = $full_name.'<'.$email_from.'>'; $subject = "testing sender name"; $message = ""; …
Suraj Hazarika
  • 647
  • 3
  • 9
  • 23
30
votes
6 answers

python imaplib to get gmail inbox subjects titles and sender name

I'm using pythons imaplib to connect to my gmail account. I want to retrieve the top 15 messages (unread or read, it doesn't matter) and display just the subjects and sender name (or address) but don't know how to display the contents of the…
sadmicrowave
  • 39,964
  • 34
  • 108
  • 180
24
votes
3 answers

List-unsubscribe in e-mail header. How-to?

I'm trying to add a List-Unsubscribe header to my e-mail that is being sent. So far I hadn't any luck trying to do so. What I have got so far: var mailMessage = new MailMessage { Subject =…
Gerard
  • 1,829
  • 5
  • 16
  • 20
18
votes
1 answer

As a recipient, is it possible to detect if an email was sent via Gmail's "Schedule Send" vs. "Send"?

Just curious if the email headers are marked by Gmail to denote if the email was scheduled vs sent right away.
xd1936
  • 1,038
  • 2
  • 9
  • 27
17
votes
1 answer

Correct headers for replying and forwarding emails

Are you that programmer that knows all about emails? Can you dream about mail headers, write them with your eyes closed? Maybe you might be able to help me with this issue. Let me explain ... Workflow The mail server receives emails A PHP cronjob…
Peter
  • 8,776
  • 6
  • 62
  • 95
16
votes
5 answers

Set the Message-ID mail header in Rails3 / ActionMailer

I would like to alter the Message-ID header that is in the header portion of an email sent from a Ruby on Rails v3 application using ActionMailer. I am using Sendmail on localhost for mail delivery. Do I configure this in Sendmail or…
Teddy
  • 18,357
  • 2
  • 30
  • 42
15
votes
2 answers

Do all email clients use "In-Reply-To" field in email header?

When any email is send with a Message-ID header, then any replies to it include In-Reply-To, naming that ID, and References which can name a list of parent message ID's. So email clients can use this information to construct threads when viewing a…
slayer
  • 393
  • 1
  • 5
  • 19
13
votes
2 answers

Multiple In-Reply-To

Mail user agents usually display threads of Emails by chaining messages together according to the In-Reply-To and References header fields that contain the Message-IDs of other messages. Although a mail usually only replies to one other message, it…
XZS
  • 2,374
  • 2
  • 19
  • 38
12
votes
1 answer

How can the Return-Path header be different than the actual email bounce recipient?

I recently moved my transactional email sending to Mailgun It works good so far however I am wondering about the return-path header. Consider this email (I removed irrelevant header and replaced email/domain for privacy purposes) Delivered-To:…
The Surrican
  • 29,118
  • 24
  • 122
  • 168
12
votes
1 answer

What do X-headers in mails stand for?

I'm wondering what all X- headers in e-mails stand for. Are they really just a custom and everyone can make them up? Are they documented somewhere? I've quickly browsed RFC 5322. It does not seem to mention anything about custom headers. When or by…
romanofski
  • 1,122
  • 1
  • 12
  • 18
1
2 3
26 27