Here's a chunk of code that
is in production at my office:
my $subject = "FLR invoices";
my $msg =
MIME::Entity->build(
From => SOURCE,
To => TARGET,
Subject => $subject,
Type => "multipart/mixed",
);
my $textpart = <<END;
Attached is the XML file $xmlfile.
Andy
END
# Add the text greeting
$msg->attach(
Type => 'text/plain',
Encoding => '7bit',
Data => $textpart,
);
# Add the XML file
$msg->attach(
Type => 'text/xml',
Encoding => 'base64',
Description => "XML file $xmlfile",
Path => $xmlfile,
);
$msg->send( 'sendmail' );
Note that the body is specified thru a variable, and
the attachment is a file. I'm pretty sure you don't
have to specify a filename when you create the attachment.
xoxo,
Andy
--
<megaphone>
Throw down the gun and tiara and come out of the float!
</megaphone>