Using the following code I'm able to send files, but when I send an excel file it comes out the other in the right size, but excel fails to open it. I'm betting this is something obvious, but any help is appreciated. BTW This is a command line script, i just use CGI to handle command line parameters because i'm lazy and it works.

use strict; use warnings; use MIME::Lite; use CGI; my $cgi = new CGI; MIME::Lite->send('smtp', '192.168.11.203', Timeout=>60); my $to = $cgi->param("to"); my $from = $cgi->param("from"); my $subject = $cgi->param("subject"); my $text = $cgi->param("text"); my @files = ($cgi->param("files")); my $msg = MIME::Lite->new( To => $to, From => $from, Subject => $subject, Type => 'multipart/mixed', ); $msg->attach(Type => 'TEXT', Data => $text ); for my $file (@files) { $msg->attach(Id => $file, Path => $file ); } $msg->send; ### will now use Net::SMTP as shown above

___________
Eric Hodges

In reply to Sending Email Attachment by eric256

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.