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
3
votes
2 answers

Parsing Message-ID header returned by imaplib

I'm fetching the messageid from emails in Gmail via IMAP. This code: messageid = m.fetch(num, '(BODY[HEADER.FIELDS (MESSAGE-ID)])') print messageid returns this: [('1 (BODY[HEADER.FIELDS (MESSAGE-ID)] {78}', 'Message-ID:…
HankSmackHood
  • 4,673
  • 7
  • 29
  • 30
3
votes
1 answer

Threading without In-Reply-To: Message-ID?

So our system is sending us email notifications regarding specific incidents. The problem is, things get really spammy and disorganized, and we really want to have our email client (Gmail) thread notifications regarding the same incident. So for…
user1788210
  • 67
  • 1
  • 5
3
votes
1 answer

Add headers to outgoing smtp message that will exist in reply

I need to create a correlation between an outgoing e-mail to a reply e-mail without changing the subject or body. I've tried to add some headers to an SMTP outgoing mail: var outgoingMessage = new…
ohadinho
  • 6,894
  • 16
  • 71
  • 124
3
votes
3 answers

Parsing Email header fields using C/C++

I've a C code where I fetch headers for all mails in the inbox via imap issuing UID FETCH 1:* (FLAGS BODY[HEADER]) command. Due to special authentication requirements I cannot use a standard imap library like vmime or libetpan. I need to parse the…
Nands
  • 1,541
  • 2
  • 20
  • 33
3
votes
2 answers

How to change email address in Reply-To header of Wordpress email

Hi I am using Wordpress on Bluehost. I want to change the Reply-to header of the emails sent. I am using the filter 'wp_mail' to filter the 'headers' array described in the wp_mail filter documentation of the wp codex. Here is my code, showing the…
malena
  • 798
  • 11
  • 26
3
votes
2 answers

Content-Type with charset only

I came across this interesting header: Content-Type: charset=utf-8 Set HTTP header to UTF-8 using PHP The answerer says that this syntax is defined by RFC 2616, but I am not seeing it in the provided link. Is this valid syntax, and if so…
Zombo
  • 1
  • 62
  • 391
  • 407
3
votes
1 answer

Logic of Message-ID created by MS Outlook

Could somebody please explain the logic of Message-ID created by MS Outlook? especially this part “D45A2C0A.EB29” User-Agent: Microsoft-MacOutlook/14.6.9.160926 Date: Tue, 22 Nov 2016 17:08:26 -0600 Subject: Video playback error From: “AAAAAAAAAAAA…
Vinod Kd
  • 81
  • 1
  • 6
3
votes
1 answer

Email-Headers: Sender vs. x-sender

If you want to "Send Email On Behalf Of" someone else, should you use the 'Sender' heading or the 'x-sender' heading? Outlook 2007 seems to only pay attention to the 'Sender' heading, if it's present. On the other hand, there are those who…
Jim G.
  • 15,141
  • 22
  • 103
  • 166
3
votes
0 answers

wp_mail content transfer encoding header

I'm having a strange issue with wp_mail() -- for some admin users, the sent message includes a Content-Transfer-Encoding: quoted-printable header, which breaks the HTML of the email message. I'm using: add_filter('wp_mail_content_type',…
HWD
  • 1,547
  • 7
  • 36
  • 72
3
votes
2 answers

How to identify Outlook's "Out of office" autoreply?

I'm working on a mail server that receives messages from users. I want to be able to filter Outlook's "Out of office" autoreply messages. It seems that there's no special header in those messages, so it seems that the only option is to identify them…
arikfr
  • 3,311
  • 1
  • 25
  • 28
3
votes
1 answer

How to dynamically set unsubscribe link in sendgrid using PHP / Laravel

I'd like to dynamically set unsubscribe links using Sendgrid in my PHP/Laravel similar to how its been demonstrated with Ruby on Rails. I see that I need to set a header with JSON. Can someone help figure out how this header gets integrated with a…
tim peterson
  • 23,653
  • 59
  • 177
  • 299
3
votes
1 answer

Search gmail api by custom header

I am trying to search gmail api with custom header (this case it is named notification-id), but it does not work. Request I am making: GET…
3
votes
1 answer

Java MimeMessage.saveChanges not calling updateMessageID

I am developing an application that needs to send an email via JavaMail with a specific Message ID. I have extended the Java MimeMessage class to override the updateMessageID method so that I can set the message ID myself. The problem is that when I…
Kirs10
  • 31
  • 1
3
votes
1 answer

What are the valid characters for a Mime Multipart message ContentId "CID:"?

From reading the RFC it appears that CID can/must only contain characters from the same set as those permissable by a regular URI. Is this correct. Im asking because I wish to writeup a simple helper that takes a CIDs prefix and adds a counter when…
mP.
  • 18,002
  • 10
  • 71
  • 105
3
votes
1 answer

HTML Email sent via PHP treated as spam in Gmail

I have the following php script which loads a html template from a .txt file on my server and uses str_replace to populate the template with the Email content before sending the email. At first I tried hardcoding my Webmail address on my server into…
jezzipin
  • 4,110
  • 14
  • 50
  • 94