- For individual users
- Instant access to solutions
- Ask your tech questions
- Start your 30-day Free Trial
Main Topics
Browse All TopicsOk, I know how to use Net::SMTP to send messages with a single recipient but I am having problems using $smtp->bcc(). I want to send to multiple recipients in the bcc field. I have tried variables and arrays but nothing seems to work.
A side note: some addresses are not delivered to. i.e. the mail sent from my script is never received. Any ideas where I should start to look?
my $ServerName = $smtpserver;
$smtp = Net::SMTP->new($ServerName
$smtp->mail( $from );
$smtp->to( $to );
$smtp->data();
$smtp->datasend("To: $to\n");
$smtp->datasend("From: $from\n");
$smtp->datasend("Date: $mdate\n");
$smtp->datasend("Subject: $subject\n");
$smtp->datasend("MIME-Vers
$smtp->datasend("Content-t
$smtp->datasend("Content-T
$smtp->datasend("\n");
$smtp->datasend("$msg\n\n"
$smtp->dataend();
$smtp->quit();
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: revantinePosted on 2004-11-22 at 06:12:45ID: 12644440
This is from a script I use for automated invoicing. It emails the client and bcc's to myself. The syntax below is from the notes I made from my programming and testing senarios. Although I only BCC myself, I would not have left the note in place if it didn't work when I tested.
ion: 1.0\n"); ype: text/html; charset=us-ascii\n");
\n");
$smtp->mail($from);
$smtp->to($to);
$smtp->bcc($bcc, $anotherbcc, $onemorebcc);
# to ( ADDRESS [, ADDRESS [...]] )
# cc ( ADDRESS [, ADDRESS [...]] )
# bcc ( ADDRESS [, ADDRESS [...]] )
$smtp->data();
$smtp->datasend("From: $from\n");
$smtp->datasend("To: $to\n");
# build a subject string
$SUBJECT="An email from us";
$smtp->datasend("Subject: ".$SUBJECT."\n");
$smtp->datasend("MIME-Vers
$smtp->datasend("Content-T
$smtp->datasend("\n");
$smtp->datasend("Hope you are well.\n");
$smtp->datasend("Have fun for the holidays\n");
$smtp->datasend("Revantine
# dataend
$smtp->dataend(); # NOT datasend!
$smtp->quit;