Hi, I am able to send single attachment but not multiple attachments. Can Any one help? The following code only attached one file from the directory
my $msg = MIME::Lite->new (
From => $msgFrom,
To => $msgTo,
Subject => $msgSubject,
Type =>'multipart/alternative',
) or die "Error creating multipart container: $!\n";
# Create the HTML part
my $html_part = MIME::Lite::->new(
'Type' => 'multipart/related',
);
$html_part->attach(
'Type' => 'text/html',
'Data' => qq{
<body>
<p>hello</p>
</body>
},
);
my $att_part;
my @files = glob("F:/folder/*");
$att_part = MIME::Lite::->new(
'Type' => 'application/octet-stream',
'Encoding' => 'base64',
'Path' => shift @files,
);
$msg->attach($html_part);
$msg->attach($att_part);
my $email = $msg->as_string();
my $smtp = Net::SMTP_auth->new($smtphost, Port=>$smtpport) or die "Can
+'t connect";
$smtp->mail($msgFrom) or die "Error:".$smtp->message();
$smtp->recipient($msgTo) or die "Error:".$smtp->message();
$smtp->data() or die "Error:".$smtp->message();
$smtp->datasend($email) or die "Error:".$smtp->message();
$smtp->dataend() or die "Error:".$smtp->message();
$smtp->quit or die "Error:".$smtp->message();