1

I use the postfix 2.9.6 and use a milter to read the contents for my application. I am seeing Postfix swallows Bcc: header from the incoming emails and my milter missed just that Bcc header. Is there a reason why this is happening and any way of telling postfix not to remove this Bcc header? I searched and couldnt find any clues with respect to this issue.

  • 1
    Why should the Bcc header still exists for incoming mail? The whole point of Bcc is, that the recipient does not see the additional recipient. It is removed on the outgoing MTA. – Gerald Schneider Nov 24 '17 at 08:55

1 Answers1

3

Postfix does nothing with the BCC field, as far as I know.

The BCC address, like the Cc is something that only exists in your email client. SMTP servers only know the RCPT TO: address in the envelope.

Just like snail mail letters, SMTP email has two different sets of address information: the envelope headers (like the addresses printed on the outside of an envelope) which are used by the SMTP servers to route and deliver the email, and the normal headers, which are part of the mail message and which are only read and interpreted by the user in his mail client/webmail, just like the address attached to a salutation at the start of the physical letter that was in the envelope.

Unlike the post office, SMTP usually throws away most of the envelope before it hands the message to the user.

When communicating with the outgoing SMTP server your email client will set for each of the recipients (each of the addresses in the To: , CC: and BCC: fields in your email client) as unique "RCPT TO:" addresses in the envelope and then simply won't include any of the BCC addresses in the message itself.

A simple telnet mail session might illustrate this better:

[user@example ~]$ telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.

<<< 220 example.com ESMTP Sendmail 8.14.4/8.14.4; Fri, 17 Jul 2015 20:29:26 +0200

helo localhost

<<< 250 example.com Hello localhost [127.0.0.1], pleased to meet you

MAIL FROM:me@localhost

<<< 250 2.1.0 me@localhost... Sender ok

RCPT TO:user@example.com

<<< 250 2.1.5 user@example.com... Recipient ok

RCPT TO:cc@example.com

<<< 250 2.1.5 cc@example.com... Recipient ok  

RCPT TO:bcc@example.com

<<< 250 2.1.5 bcc@example.com... Recipient ok 

DATA

<<< 354 Enter mail, end with "." on a line by itself


Subject: test
From: me@example.com
To: user@example.com
Cc: cc@example.com

this is an email message.
that has two lines.
.
<<< 250 2.0.0 t6HITQXA020072 Message accepted for delivery
quit

Edit

I did't check with the newest Postfix version but apparently the postfix cleanup daemon will by default remove the following message headers from the message body: Bcc, Content-Length, Resent-Bcc, and Return-Path. This behaviour can be tuned with the message_drop_headers setting in the main.cfg:

Available in Postfix version 3.0 and later:

message_drop_headers (bcc, content-length, resent-bcc, return-path) Names of message headers that the cleanup(8) daemon will remove after applying header_checks(5) and before invoking Milter applications.

HBruijn
  • 72,524
  • 21
  • 127
  • 192
  • We are using postfix to get messages for backing up data and not really doing a mail routing. In your example, we send data from the client in the data like this: Subject: test From: me@example.com To: user@example.com Cc: cc@example.com Bcc: bcc@example.com and i know postfix received the bcc header but filtering out this Bcc line when sending to milter.. I need the bcc line if sent by the client. – Sathish Kumar Nov 25 '17 at 12:54
  • @SathishKumar Apparently I use an older Postfix version, please see my edit. – HBruijn Dec 01 '17 at 07:45