sending an excel attachment with MIME::Lite

Discussion in 'Perl Misc' started by p cooper, Jan 31, 2004.

  1. p cooper

    p cooper Guest

    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'
    );
     
    p cooper, Jan 31, 2004
    #1
    1. Advertising

  2. p cooper

    Ben Morrow Guest

    p cooper <> wrote:
    > 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

    --
    don't get my sympathy hanging out the 15th floor. you've changed the locks 3
    times, he still comes reeling though the door, and soon he'll get to you, teach
    you how to get to purest hell. you do it to yourself and that's what really
    hurts is you do it to yourself just you, you and noone else *
     
    Ben Morrow, Jan 31, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Aaron Brady

    SQL, lite lite lite

    Aaron Brady, Dec 29, 2008, in forum: Python
    Replies:
    15
    Views:
    762
    Aaron Brady
    Jan 1, 2009
  2. Jane Humbrey
    Replies:
    5
    Views:
    280
    Jane Humbrey
    Sep 1, 2003
  3. James
    Replies:
    1
    Views:
    252
    Paul Lalli
    Aug 4, 2004
  4. ecureuil
    Replies:
    0
    Views:
    328
    ecureuil
    May 28, 2006
  5. Ted Byers
    Replies:
    20
    Views:
    1,752
    Peter J. Holzer
    Jun 25, 2010
Loading...

Share This Page