sending an excel attachment with MIME::Lite

P

p cooper

Ive converted a pipe-delimited file to excel format with
Spreadsheet::WriteExcel;

I now want to email it using MIME::Lite

anyone help out with
$message ->Type & encoding
( and the other stuff if its not correct)


my $message = MIME::Lite->new(
From => 'xxxxx' ,
To => 'xxx' ,
Cc =>'xx',
Subject => 'The database file as an Excel format,
Type => 'application/excel',
Encoding => '8bit',
Data => "Database files"
);

my ($mime_type, $encoding) = ('application/xls', 'base64');

$message->attach (
Type => $mime_type ,
Encoding => $encoding ,
Path => '/tmp/file.xls' ,
Filename => 'file.xls'
);
 
B

Ben Morrow

p cooper said:
Ive converted a pipe-delimited file to excel format with
Spreadsheet::WriteExcel;

I now want to email it using MIME::Lite

anyone help out with
$message ->Type & encoding
( and the other stuff if its not correct)


my $message = MIME::Lite->new(
From => 'xxxxx' ,
To => 'xxx' ,
Cc =>'xx',
Subject => 'The database file as an Excel format,
Type => 'application/excel',

You don't want this here. Probably you don't want a type here at
all. If you do want one, you want multipart/mixed.
my ($mime_type, $encoding) = ('application/xls', 'base64');

The list of MIME types is at
http://www.iana.org/assignments/media-types/index.html, and the
correct one for Excel is appliaction/vnd.ms-excel. The encoding should
be Base64.

Note that this is not a Perl question.

Ben
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top