Hi - I'm having trouble with attachments while using MIME::Lite::TT::HTML. If I use :
$msg->attr("content-type" => "multipart/mixed");
The template.txt.tt gets preference and my nice template.html.tt is a long scroll down the email away. However, if leave out that attribute assignment the template.html.tt show up first . . . but the attachment isnt there!
Here's my code . . . and thanks :
my %params;
$params{param1} = $param1;
$params{param2} = $param2;
my %options;
$options{INCLUDE_PATH} = '/var/www/html/test';
my $msg = MIME::Lite::TT::HTML->new(
From => 'me@domain.com',
To => 'user@domain.com',
Subject => "Test",
Template => {
html => 'template.html.tt',
text => 'template.txt.tt',
},
TmplOptions => \%options,
TmplParams => \%params,
);
# Set our content type properly
$msg->attr("content-type" => "multipart/mixed");
$msg->attach( Type => 'application/msexcel',
Path => '/var/www/cgi-bin/test/test.xls',
Filename => 'test.xls',
Disposition => 'attachment'
);
$msg->send('smtp', 'smtp.domain.com', Timeout=>60);