How do I send a message to multiple addressees? I can't seem to get the syntax right. Here's my script:
send_mail($to, $from, $subject, $comments, $username, $userip, $useremail, $userurl, $daten, $timen);
sub send_mail {
use Net::SMTP;
my $relay = "domain.com";
my $smtp = Net::SMTP->new($relay)
|| die "Can't open mail connection: $!";
$smtp->mail($fromemail);
$smtp->to($useremail,$masteremail);
$smtp->data();
$smtp->datasend("To: $useremail,$masteremail\n"
;
$smtp->datasend("From: $fromemail\n"
;
$smtp->datasend("Subject: Thank you for visiting domain.com\n"
;
$smtp->datasend("\n"
;
$smtp->datasend("\n"
;
$smtp->datasend("\n"
;
$smtp->datasend("A copy of your comments can be found below\n"
;
$smtp->datasend("======================================\n"
;
$smtp->datasend("NAME: $username($userip) at $daten($timen)\n"
;
$smtp->datasend("EMAIL: $useremail\n"
;
$smtp->datasend("HOME PAGE: $userurl\n"
;
$smtp->datasend("\n"
;
$smtp->datasend("$comments\n"
;
$smtp->datasend("======================================\n"
;
$smtp->dataend();
It works if I send to $masteremail only, but not from $useremail only. $masteremail is hard-coded, $useremail is a form input which is parsed correctly and displayed in the resulting guestbook entry as a good hyperlink. Is this a simple syntax error? Newposter
"Good judgment comes from experience. Experience comes from bad judgment."
send_mail($to, $from, $subject, $comments, $username, $userip, $useremail, $userurl, $daten, $timen);
sub send_mail {
use Net::SMTP;
my $relay = "domain.com";
my $smtp = Net::SMTP->new($relay)
|| die "Can't open mail connection: $!";
$smtp->mail($fromemail);
$smtp->to($useremail,$masteremail);
$smtp->data();
$smtp->datasend("To: $useremail,$masteremail\n"
$smtp->datasend("From: $fromemail\n"
$smtp->datasend("Subject: Thank you for visiting domain.com\n"
$smtp->datasend("\n"
$smtp->datasend("\n"
$smtp->datasend("\n"
$smtp->datasend("A copy of your comments can be found below\n"
$smtp->datasend("======================================\n"
$smtp->datasend("NAME: $username($userip) at $daten($timen)\n"
$smtp->datasend("EMAIL: $useremail\n"
$smtp->datasend("HOME PAGE: $userurl\n"
$smtp->datasend("\n"
$smtp->datasend("$comments\n"
$smtp->datasend("======================================\n"
$smtp->dataend();
It works if I send to $masteremail only, but not from $useremail only. $masteremail is hard-coded, $useremail is a form input which is parsed correctly and displayed in the resulting guestbook entry as a good hyperlink. Is this a simple syntax error? Newposter
"Good judgment comes from experience. Experience comes from bad judgment."