Since you are sending excel files, I guess you might want to send it so that the Microsoft mail mechanisms can do their thing. This was posted by another monk earlier this year.
#!/usr/bin/perl
use MIME::Entity;
use Net::SMTP;
# create the multipart message with attachments
$msg = MIME::Entity->build(
Type => 'multipart/mixed',
From => 'bogus@mail.com',
# The "To" here is displayed in the message header as "To"
# This is not the actual list of recipients
To => '"Display Name" <user1@mail.com>, "Second Person"
<user2@mail.com>',
Subject => 'Automatic email of Excel report',
);
$msg->attach(
Type => 'application/msexcel',
Path => $report,
Filename => 'college_orders.xls',
Encoding => 'base64'
);
$msg->attach(
Data => "Enclosed is the daily report of orders.
(automated delivery)"
);
# send the message
$smtp = Net::SMTP->new("smtp.mail.com");
#authenticate if required
$smtp->auth( "login", "passwd" );
# Identify yourself to the smtp server
$smtp->mail('bogus@mail.com');
# The syntax for "To" is different in MIME::Entity and Net::SMTP
# The "to" here is the list of actual recipients and is not displayed
$smtp->to( 'user1@mail.com', 'user2@mail.com' ) || die "Bad address";
# Send the message and attachments
$smtp->data( [ $msg->as_string ] ) || die "mail not accepted";
$smtp->quit;
exit;
|