Can someone show me an example of how a module call would look?
i.e. I'm getting all kinds of errors trying to get Mime::Lite to
actually send an email with an attachment, and I want to make sure
I have the syntaxes correct.
Thanks ahead.
E Preble
I use this on an NT machine, and since Mime::Lite explicitly calls
sendmail, I have to save the message body as a string and then use
Net::SMTP to send it. Something like this (not a binary attachment, but
it sounds like your problem is the sending) ...
use File::Basename;
use MIME::Lite;
use Net::SMTP;
...
my $msg = new MIME::Lite
Subject =>"ECR Status Report",
Type =>'text/html',
Path =>$htmlfile,
Filename =>basename($htmlfile);
attach $msg
Type =>'text/plain',
Path =>$csvfile,
Filename =>basename($csvfile);
smtp($msg->as_string(), $smtphost, $sender, @recipient);
sub smtp {
my ($message, $mailhost, $sender, @recipient) = @_;
# Sends email to a list of recipients using Net::SMTP
my $smtp = Net::SMTP->new($mailhost);
$smtp->mail($sender);
$smtp->to(@recipient);
$smtp->data();
$smtp->datasend("From: $sender\n");
$smtp->datasend("To: " . join(', ', @recipient) . "\n");
$smtp->datasend($message);
$smtp->dataend();
$smtp->quit();
}
--
David Daniel