Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

mime::lite and attaching files

by PerlSufi (Friar)
on Apr 29, 2013 at 21:40 UTC ( #1031288=perlquestion: print w/ replies, xml ) Need Help??
PerlSufi has asked for the wisdom of the Perl Monks concerning the following question:

Hello monks, I am having a problem attaching an excel file with MIME::Lite. In outlook it says the file is corrupted and opens blank even though it is 328B. Here is my section of code that I attempted to perform this with:
my $msg = MIME::Lite->new( From => 'me@me.com', To => 'me@me.com', #Cc => 'some@other.com, some@more.com', Subject => 'Report', Type => 'multipart/mixed' ); $msg->attach( Type =>'TEXT', Data =>"Here is the Report" ); $msg->attach( Type => 'application/vnd.ms-excel', Encoding => 'base64', Path => "/report.xls", Filename => 'report.xls' ); $msg->send;

Is it something with the encoding that I am not getting?

Comment on mime::lite and attaching files
Download Code
Replies are listed 'Best First'.
Re: mime::lite and attaching files
by igelkott (Curate) on Apr 29, 2013 at 23:04 UTC
    Path => "/report.xls"

    Is your file really in the root directory? Do you perhaps just mean Path => 'report.xls' ? If so, the "Filename" parameter is not needed.

      actually I had the full path before, I just put that in there because I tried that, too. taking out the path also did not work. I'm stumped..
        I got it. I ended up using mime::entity instead..

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1031288]
Approved by igelkott
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (12)
As of 2015-07-31 18:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (280 votes), past polls