http://qs321.pair.com?node_id=360464

Kozz has asked for the wisdom of the Perl Monks concerning the following question:

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:
X-Final-To: bccaddress@site.com
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.