Here is an example that works on my Win32 box:

use MIME::Lite; my $smtp = 'mail.trump.net.au'; # (typically your ISPs SMTP server) my $from = 'james.freeman@smartsurf.org'; my $to = $from; my @cc = qw( ); # add addresses here to Cc, space separated my $sbj = 'A test with attachment'; my @cc = ( "Cc" => (join ',', @cc) ) if @cc; my $msg = MIME::Lite->new( From => $from, To => $to, @cc, Subject => $sbj, Type =>'multipart/mixed', ) or die "Could not create Mime::Lite object!"; $msg->attach( Type =>'TEXT', Data =>"Here's the file you wanted" ); $msg->attach( Type =>'image/gif', # often 'application/octet-stre +am' Path =>"C:\\background.gif", # full path to file Filename =>'background.gif' # name we want to use in email +for file ); #print $msg->as_string; $msg->send_by_smtp( $smtp) or die "Could not send mail $!\n";

cheers

tachyon


In reply to Re: Re: Re: Re: Re: Re: Re: Using MIME-Lite to send attachment by tachyon
in thread Using MIME-Lite to send attachment by rscott212

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.