Link to home
Start Free TrialLog in
Avatar of mgreenbe
mgreenbe

asked on

Using NET:SMTP module in Perl having problems specifying mutiple CC: recipients

Usign the perl NET:SMTP module I am having issues when the CC list contains more than one recipient. I found a solution here on the site and followed steps but still does not send to defined CC list addresses. Pls see code snippet attached.

sub send_email {
 
use Net::SMTP;
 
open(EFILE2,"<$text_attach") || die "Could not open email file $!\n";
 
(@lines) = <EFILE2>; 		# read file into list
close(EFILE2);
 
$smtp = Net::SMTP->new("xx.xx.xx");
 
$from="nyrccnet\@lehman.com";
$cc_list="gvijayen\@lehman.com mgreenbe\@lehman.com";
$recip2="gvijayen\@lehman.com";
 
 
$smtp->mail("$from");
 
###############################################
##$smtp->to("$recip,$cc_list");
##$smtp->cc("$cc_list");
##$smtp->bcc("$bcc");
###############################################
 
$smtp->recipient($recip2,$cc_list);
$smtp->data;
 
$smtp->datasend("To:  $recip2\n");
$smtp->datasend("From:  $from\n");
 
$smtp->datasend("Cc: $cc_list\n");
$smtp->datasend("Bcc: $bcc\n");
$smtp->datasend("Subject: $subject\n");
 
$smtp->datasend("MIME-Version: 1.0 \n"); 
$smtp->datasend("Content-Type: text/html; charset=us-ascii \n");  
$smtp->datasend("\n");
 
$smtp->datasend(@lines); 
 
$smtp->dataend(); 
$smtp->quit; 
 
}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Adam314
Adam314

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial