in reply to Email::MIME won't send email to Bcc addresses

The BCC (blind carbon copy) "header" is not really an e-mail header. Clearly, it cannot be an e-mail header, because if it were, then recipients could examine it, and would no longer be "blind". Rather, BCC is a concept used by mail user agents, and usually implemented to that it appears (to end users) to be a header.

Firstly, you need to understand that the message headers are not used to route the message to its recipients - they are purely informational. Instead, so called envelope addresses (part of SMTP) are used.

And so, to implement BCC, what mail clients do, is simply send the e-mail to the intended recipient using the envelope address, but without adding any message header.

In your particular case, what you need to do is:

  1. When constructing the message (Email::MIME->create), do not add a BCC header.
  2. When sending the message (sendmail), add an extra option, to (just like your current from option) which takes as its value an arrayref of all the e-mail addresses to which the e-mail should be sent. This includes not just the recipients you want to BCC it to, but also the non-blind recipients (To, CC).

Something along these lines (though it isn't clear from your example what exactly $email_cc and $email_bcc contain - a single address, a comma-separated list, etc).

my $email = Email::MIME->create( header_str =>[ To => $email_to, Cc => $email_cc, From => $email_from, Subject => $email_subject ], body_str =>$email_body, attributes => { content_type => 'text/html', charset => 'utf8', encoding => 'quoted-printable' } # ... try { sendmail( $email, { to => [$email_to, $email_cc, $email_bcc], from => $email_from, transport => Email::Sender::Transport::SMTP->new({host => $ +SMTP_HOSTNAME,port => $SMTP_PORT}) } ); } catch { print $_->message};

Replies are listed 'Best First'.
Re^2: Email::MIME won't send email to Bcc addresses
by fshrewsb (Acolyte) on Jan 11, 2012 at 14:45 UTC

    Thanks for the responses all. Now that you've explained it, it makes perfect sense. Any email address which is in the

     to => [ .. ]

    list, but not in the "To" or "Cc" header is effectively a Bcc'd address. Needless to say, Email::MIME works fine. Thanks again !