I'm am sending an email with an attached ZIP file to my AOL email address using MIME::Lite. I do receive the email with the ZIP file attached, but the ZIP file is corrupted. :(

Now, what probably comes first to mind is that the ZIP file must have been created in a corrupted state, or that AOL is corrupting it. Well, I've checked that. My application also FTP's the ZIP file to an FTP site. If I manually connect to the FTP site, download the ZIP to my PC, I can open it, and extract the contents, and all of it is just as I would expect. If I email the ZIP file from my PC at work to my AOL account using MS Outlook, I can logon to AOL, open the email, download the attached ZIP file, and open it. If I email, using my MIME::Lite code, the ZIP file to my work email address, Outlook says the ZIP file is corrupted. So, that seems to me to leave MIME::Lite as the problem.

The following is not my exact code, I won't have access to it for a while, but it's pretty close, as I pretty much cut-and-pasted this code from the example at CPAN, changing just the file names, email addresses, etc to my situation. BTW, you'll notice a "Debug=>1" in the code below. That causes a BUNCH of stuff to be spit out, and I don't see anything in that which would indicate a problem.

Final comment, for now. The "debug output" indicates that Content-Type-Encoding is 'base64'. I read somewhere else that MIME::Lite "knows" to set that based on the the "Type => 'application/zip' specification in the code.

Thanks for any insight you can provide on this

Here's the code:

### Create a new multipart message: $msg = MIME::Lite->new( From =>'me@myhost.com', To =>'you@yourhost.com', Cc =>'some@other.com, some@more.com', Subject =>'A message with 2 parts...', Type =>'multipart/mixed' ); ### Add parts (each "attach" has same arguments as "new"): $msg->attach( Type =>'TEXT', Data =>"Here's the ZIP file you wanted" ); $msg->attach( Type =>'application/zip', Path => $HOME, Filename =>'little.zip', Disposition => 'attachment' ); ### use Net:SMTP to do the sending $msg->send('smtp','some.host', Debug=>1 );

In reply to Corrupted ZIP file using MIME::Lite by rlambert7

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.