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};

In reply to Re: Email::MIME won't send email to Bcc addresses by tobyink
in thread Email::MIME won't send email to Bcc addresses by fshrewsb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.