I tested this snippet locally without modification, other than substituting my email address and adding use strict/warnings/MIME::Lite.

I succesfully tested sending a mail with a tar file created by both my native tar binary and Archive::Tar. Both mails were received, and untarring the file on the other end worked fine.

The only failure I encountered was when I did not add any files to the newfile.tar. A file created with this:

perl -MArchive::Tar -e '$t = Archive::Tar->new(); $t->write("newfile.t +ar")'
Yielded the following when reading the file with tar -tf:
tar: Cannot identify format. Searching... tar: End of archive volume 1 reached tar: Sorry, unable to determine archive format.
These tests were performed on OpenBSD 3.5, perl 5.8.2, Archive::Tar 1.10, MIME::Lite 3.01. Mails were read with mutt and gmail.

In reply to Re: Problem in sending "tar" files as attachment using MIME::Lite module by imp
in thread Problem in sending "tar" files as attachment using MIME::Lite module by santhi

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.