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
7
votes
1 answer

Convert data from email header

Does anyone could help me how to convert data from email header? I have the next date format from email header: Wed, 28 Apr 2010 21:59:49 -0400 I need to convert them into mysql Date, or timestamp. Thanks!
d7p4x
  • 487
  • 1
  • 5
  • 16
6
votes
1 answer

How to Get Body of email from Pipe to program

I am piping an email to a program and running some code. ** I know how to get the "From:" and the "Subject:" but how do I get only the body of the email? ** #!/usr/bin/php -q
vizenor
  • 63
  • 1
  • 3
6
votes
4 answers

Having Issue on Setting Array of $headers in PHP Mail Function

I am not able to send email through PHP mail function while I specify an array of $headers as $headers = array ( 'From' => "info@mysite.com", 'Content-type' => "text/html;charset=UTF-8" …
Suffii
  • 5,694
  • 15
  • 55
  • 92
6
votes
3 answers

Setting an email header on objective-C?

I'm trying to make an app that sends an email using MFMailComposeViewController but that class doesn't seem to provide a way to set email headers. I tried to look for a lower level solution (or even a library) that does this but couldn't find one.…
Vlad
  • 8,038
  • 14
  • 60
  • 92
6
votes
1 answer

How can I determine the email client from email headers?

It seems like most popular email clients don't include the X-Mailer header. Is there any good method to determine if an email was sent by a popular client, such as Gmail, Outlook or Apple Mail?
David Mihal
  • 944
  • 6
  • 23
6
votes
1 answer

Email: legitimate duplicate email header keys with mutually exclusive values

In email the Received: header can legitimately occur more than once with mutually exclusive values... Received: three.example.com Received: two.example.com Received: one.example.com Are there any other headers can occur in email headers multiple…
John
  • 1
  • 13
  • 98
  • 177
6
votes
1 answer

Custom mail headers using MIME in Java

I want to create a new custom header while sending email, but by using setHeader() and addHeader() methods I am unable to do it. How can I create a user defined X-"" email header?
ganga
  • 71
  • 1
  • 1
  • 5
5
votes
4 answers

Given an email as raw text, how can I send it using PHP?

I've got a PHP script that my mail server is piping emails to via STDIN. Is there a straightforward/non-convoluted way to take a raw email string and send/forward/relay it to a specific email address? I hesitate to use PHP's mail() or Pear::Mail…
Wilco
  • 32,754
  • 49
  • 128
  • 160
5
votes
1 answer

Encrypting Headers S/MIME message/rfc822

I am looking to encrypt certain mail headers (Subject and Reply-To) which are being sent in an encrypted mail. I am taking an entire MIME (Headers included) and successfully encrypting it. I can send this S/MIME encrypted mail to my mail client…
jeeves
  • 1,871
  • 9
  • 25
5
votes
1 answer

Where to put the php $headers in a Specific Contact Form to Change the Email 'From' Address

I'm trying to use $headers = "From: webmaster@example.com\r\n"; in PHP to set the 'from' email address on a contact form to 'name@companyname.com'. It is in reference to this answer PHP mail function 'from' address I'm quite new to php so apologies…
pjk_ok
  • 618
  • 7
  • 35
  • 90
5
votes
4 answers

Method for parsing text Cc field of email header?

I have the plain text of a Cc header field that looks like so: friend@email.com, John Smith ,"Smith, Jane" Are there any battle tested modules for parsing this properly? (bonus if it's in python! the…
smurthas
  • 428
  • 1
  • 5
  • 12
5
votes
1 answer

Sending Hebrew subject in php mail goes Klingon...?

I'm trying to send email with hebrew content/subject like so: $to = 'email@email.com'; $subject = "איזה יום יפה היום"; $message = 'ממש יום יפה'; $headers = 'From: email@email.com' . "\r\n"; $headers .= 'MIME-Version: 1.0' . "\r\n"; $headers .=…
Gal
  • 23,122
  • 32
  • 97
  • 118
5
votes
0 answers

Meteor mailgun emails - replies not going to sender address

I've got a Meteor app using the useraccounts:core package for users, and my own Mailgun account configured for MAIL_URL; I've also configured the from address to be "MYNAME ". When a user signs up, a verification email is sent just…
rubie
  • 1,906
  • 2
  • 20
  • 26
5
votes
2 answers

How do I determine if an email is Base64 encoded?

I am having difficulty determining if the body of a text email message is base64 encoded. if it is then use this line of code; making use of jython 2.2.1 dirty=base64.decodebytes(dirty) else continue as normal. This is the code I have atm. What…
Setori
  • 10,326
  • 11
  • 40
  • 46
5
votes
2 answers

UTF-8 Subject line appears as question marks in Gmail

I am trying to send an email with Chinese characters in the subject line from my program to a gmail account, but the subject line appears as ????. This is how the subject line is…
Lakshmie
  • 331
  • 6
  • 17
1 2
3
26 27