http://www.perlmonks.org?node_id=923773


in reply to Mail tool to add CC and BCC

You do know the difference between headers and envelope headers, right?

Since you didn't provide an example of the code you are looking at, let's take a different approach to showing what happens... If I want to send an email by connecting to a mail server (for instance, through a telnet program), it would look something like this:

$ telnet mail.example.com 25 Trying 127.0.0.42... Connected to mail.example.com (127.0.0.42). Escape character is '^]'. 220 mail.example.com ESMTP HELO mail.example.org 250 mail.example.com MAIL FROM: <sender@example.org> 250 ok RCPT TO: <recipient1@example.com> 250 ok RCPT TO: <recipient2@example.com> 250 ok RCPT TO: <recipient3@example.com> 250 ok DATA 354 go ahead Date: 02 Sep 2011 01:45:59 -0500 Subject: test From: "Sender" <sender@example.org> To: "Recipient 1" <recipient1@example.com> CC: "Recipient 2" <recipient2@example.com> test . 250 ok 1314945967 qp 19908 quit 221 mail.example.com Connection closed by foreign host.

What this means is that BCC recipients are those who appear in the envelope header (RCPT TO lines), whereas TO and CC recipients appear both there and in the DATA section of the email.

This gives you the following email:

Received: (qmail 12019 invoked from network); 2 Sep 2011 01:46:09 -0500 Received: from mail.example.org (HELO mail.example.org) (127.0.0.23) by mail.example.com with SMTP; 2 Sep 2011 01:46:20 -0500 Received-SPF: pass (mail.example.org: SPF record at example.org designates 127.0.0.23 as permitted sender) Date: 02 Sep 2011 01:45:59 -0500 Subject: test From: "Sender" <sender@example.org> To: "Recipient 1" <recipient1@example.com> CC: "Recipient 2" <recipient2@example.com> test

Hope this helps.

Update: 2011-09-02
Added sample email output.