$address='one@example.com, two@example.com';
use Mail::Mailer;
$msg = Mail::Mailer-> new('smtp', Server=>'mysmtp.server.com');
$msg->open({
From => 'sender@example.com',
To => "$address",
Subject => 'Subject',
});
print $msg 'Body text here';
$msg->close();
####
2003-09-19 10:28:30 SMTP call from (clientname)(localhost.localdomain) [IP address] dropped: too many unrecognized commands
####
To => 'one@example.com, two@example.com',
####
$address='one@example.com, two@example.com';
my $msg = MIME::Lite-> new(
From => 'sender@example.com',
To => "$address",
Cc => 'three@example.com',
Subject => 'Subject',
Type => 'text/plain',
Data => 'Body text here'
);
$msg-> send('smtp', "mysmtp.server.com", Timeout=>60);
####
use Mime::Lite;
use Text::ParseWords;
# $address is actually taken from a combo box on a web page
# but equals the definition below.
# That's why I have done the array like this.
$address='one@example.com, two@example.com, three@example.com';
@addresses = parse_csv($address);
while(@addresses)
{
my $msg = MIME::Lite-> new(
From => 'sender@example.com',
To => shift(@addresses),
Subject => 'Subject',
Type => 'text/plain',
Data => 'Body text here.'
);
$msg-> send('smtp', "mysmtp.server.com", Timeout=>60);
}
....
sub parse_csv
{
return quotewords("," => 0, $_[0]);
}