A simple email client does not add too many headers to the email it is sending. Typically only the following headers appear in the message to be sent: “From:”,”To:”, “Subject:”,”MIME-Version:”, “Date:”,”Content-Type:”,”Content-Transfer-Encoding:”. But when you receive the email, you’ll find many extra headers have been added to the received email. The extra headers are added by postfix or other mail servers in the process of delivering the email. What headers does postfix add to an incoming email? I know there are configuration parameters such as header_checks, smtp_header_check, or milter_header_checkers that can be used to add custom headers to incoming or outgoing emails. But I’m interesting in the headers postfix adds without using these parameters.
By sending and receiving a test email to internal email address, I find the following headers are added by postfix in processing the incoming email: “Message-ID:”,”Received: “,”DKIM-Signature: “(if you use opendkim with postfix), “Return-Path:”. The “Received:” header postfix added to the message is a little complex: it contains the host name provided by the client in the EHLO command, and the client ip address. It also contains the information postfix generated such as the receiving time. The “Return-Path:” is the envelope “MAIL FROM:” sent by the client.
After postfix receives the incoming email, it delivers to cyrus-imap using the lmtp client. cyrus-imap lmtpd process also adds some headers to the email: “Received:”,”X-Sieve:”.
To check what headers are added by postfix for outgoing emails, I sent a test email to external email address. The result is the same:Postfix adds “Message-ID:”,”Received: “,”DKIM-Signature: “, “Return-Path:” to the outgoing email. But when the email reaches the external SMTP server, the external SMTP server adds more headers like “Received:”,”Delivery-date:”, “Envelope-to:” so I guess that external mail server is not a postfix server.
If you send emails to large email service providers such as outlook.com or gmail.com, their email servers will add numerous headers to your message. For example, outlook.com servers will add the following headers to the email it receives:
The headers even go into the multipart of your email body. You can see many headers are spam related with the only intention of throwing your email into their junk box:) There is little information talking about these mysterious headers. I only find a few articles on decoding/interpreting/explaining these headers.