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
5
votes
4 answers

How can I parse an email header with python?

Here's an example email header, header = """ From: Media Temple user (mt.kb.user@gmail.com) Subject: article: A sample header Date: January 25, 2011 3:30:58 PM PDT To: user@example.com Return-Path: Envelope-To:…
All Іѕ Vаиітy
  • 24,861
  • 16
  • 87
  • 111
5
votes
3 answers

What does X-Sender-Id mean in email raw source (Found in phishing email)?

Somebody in my company is being subject to phishing. My first suggestion was just to change the password. However after awhile I received a fake mail from her address again. Looking at the raw source of the email I found that there is another…
lisovaccaro
  • 32,502
  • 98
  • 258
  • 410
5
votes
3 answers

Add a custom variable to an email header already within a gmail inbox

this may seem odd but I was wondering if it was possible to add custom header details to emails already in an inbox. Like lets say I wish to add in the Header of the email something like - myvariable = myvalue and then be able to query it somehow.…
Ali
  • 7,353
  • 20
  • 103
  • 161
5
votes
3 answers

Obfuscate X-Php-Originating-Script

If there is no access to php.ini (assume php -v >= 5.3 & mail.add_x_header = 1), or a way to patch mail, is there a way to change the X-Php-Originating-Script header when using php's mail() function? The little research I did indicated that altering…
Ragamffn
  • 309
  • 1
  • 4
  • 14
5
votes
1 answer

Can we trust `reply-to` to be respected

Our webapp sends out mails on behalf of its users. The header fields are set as following: HEADERFIELD MAILADDRESS NAME ------------------------------------------------ from: [our mail address] [users name] reply-to: [users…
Muleskinner
  • 14,150
  • 19
  • 58
  • 79
5
votes
1 answer

Serializing JSON tersely with a max line length

So I'm generating a potentially lengthy JSON string for use in Sendgrid's SMTP API. Because it is going as an SMTP header, it should have a maximum line length (recommended 72, but absolutely no longer than 1000). One naive solution is described…
gtd
  • 16,956
  • 6
  • 49
  • 65
4
votes
3 answers

Get a mail application to recognize a Reply-To email php

I can't figure out how to get a mail application (except google mail) to recognize that an email was sent as a "Reply-To" and have those emails grouped together as one list of sent and replied emails. For example, using php, if I use $header =…
jao
  • 1,194
  • 1
  • 11
  • 17
4
votes
1 answer

PHP How to prevent mail from leaking script and IP in header

I'm using PHPMailer to send out an email. In the raw message of the email, the header contains X-PHP-Script: /path/to/my/script.php myip6address, myip4address I edited into the php.ini these settings [mail function] mail.add_x_header =…
John
  • 5,942
  • 3
  • 42
  • 79
4
votes
2 answers

Can anyone understand or read Microsoft anti-spam email headers?

I am setting up a small online business and have used wix.com to create a website. I created some email triggers using the websites automations which send the emails on behalf of my email domain using ascendbywix.com. The customer receives the email…
4
votes
2 answers

PHPMailer: Set mailed-by Message Header

After sending an e-mail using PHPMailer to my Gmail account, after clicking 'show details,' to the right of 'mailed-by,' it says 'yourhostingaccount.com.' Here is a picture: I've read you may change it using the fifth parameter of PHP mail(),…
Kincaid
  • 145
  • 4
  • 14
4
votes
1 answer

Custom "reply to" email header in Woocommerce New Order email notification

I'm looking to filter the email headers of the new order form in woocommerce. I'm trying to replace the customer email address with the main site admin email address. We need to do this because Gmail is flagging new orders as spam because the from…
Marco
  • 293
  • 3
  • 13
4
votes
0 answers

Send S/MIME encrypted mails using exchangelib in Python

I'm trying to send manually encrypted S/MIME mails via the exchangelib in Python. I can send simple emails and emails with attachments. I can also manually S/MIME encrypt data with OpenSSL. I can't seem to find an option for exchangelib to encrypt…
4
votes
3 answers

Getting rid of localhost from email header

I am running an ispconfig web/mail server on server1.fvdevelopment.com and the problem is that my mail ends up in spam at Google. I have everything set up rDNS, DKIM, SPF, dmarc, tested it on mail.tester.com and got 10/10 so I don't think that the…
trix87
  • 175
  • 4
  • 16
4
votes
2 answers

C# Email subject parsing

I'm building a system for reading emails in C#. I've got a problem parsing the subject, a problem which I think is related to encoding. The subject I'm reading is as follows: =?ISO-8859-1?Q?=E6=F8sd=E5f=F8sdf_sdfsdf?=, the original subject sent is…
Kenneth
  • 3,957
  • 8
  • 39
  • 62
4
votes
1 answer

In-Reply-to and Reference had been added to email header but still send as new mail but not reply

I am trying to "reply" email via PHPmailer, but not "sending a new email", but I fail even the In-Reply-to and Reference had been added to email header, that means it shows it is still a new email, the original email never been reply. Thanks for…
user7256420
  • 41
  • 1
  • 3