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 );