Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Most wise monks: I am using the module Mail::Send in a particular script because it is the best available on this server. When sending emails, I am getting a rather interesting problem, and am not sure how to deal with it.
$msg = new Mail::Send; $msg->add('From', $rs->{'em_from'} ); $msg->to( $rs->{'em_to'} ); $msg->cc( $rs->{'em_cc'} ); $msg->bcc( $rs->{'em_bcc'} ); $msg->subject( $rs->{'em_subject'} ); # print the message to mail it # $fh = $msg->open(); $fh = $msg->open('sendmail'); # explicit $rs->{'em_body'} =~ s/\n/\r\n/sg; # convert line-endings for windows m +achines. print $fh $rs->{'em_body'}; $fh->close(); # completes message and sends it
The mail gets sent just fine. However, I have a comma-delimited list of recipients in $rs->{'em_bcc'}, and the first address in the bcc list becomes part of a header:
Obviously I chose BCC for a reason, but here it's not working. Does this have to do with the order in which I am adding the headers? I don't want any BCC addresses showing up in any of the headers. I've tried setting the to, cc, etc fields when creating the new Mail::Send object too, but it all works the same of course.

Is this just a sendmail thing that I've never experienced before?

Thanks for your help.

In reply to Mail::Send and Bcc revealed by Kozz

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    and the daffodils sway...

    How do I use this? | Other CB clients
    Other Users?
    Others imbibing at the Monastery: (7)
    As of 2018-05-25 17:33 GMT
    Find Nodes?
      Voting Booth?