hellow monks,

i am constructing a new mail same as exixsting mail using MIME::Parser module. its working...
but the size of newly created mail is some kb more than the existig one.

here is my code
my $oldmail = "mailfile.eml"; my $parser = new MIME::Parser; my $entity = new MIME::Entity; $entity = $parser->parse_open($oldmail); $newmail = create_mail($entity); open(NEWMAIL, ">newmail.eml"); print NEWMAIL, $newmail->as_string; sub create_mail { my $mail = shift; my $encodetype = $mail->head->mime_encoding; if ($encodetype eq "base64") { my $body = $mail->bodyhandle; my $fname = $mail->head->recommended_filename; open(BODY, ">$fname") or die "Cant..."; print BODY $body->as_string; close(BODY); my $contype = $mail->head->get("Content-Type"); my $contranencode = $mail->head->get("Content-Transfer-Encodin +g"); my $condispo = $mail->head->get("Content-Disposition"); my $attachment = new MIME::Entity->build( Path => $fname, Type => $contype, Encoding => "base64", Filename => $fname, Disposition => $condispo); return $attachment; } elsif ($mail->parts > 0) { my $ent = new MIME::Entity; my $head = "mailhead.hdr"; open(HEAD, ">$head") or return printerror(); $mail->head->print(\*HEAD); close(HEAD); $ent->head(MIME::Head->from_file($head)); foreach my $part ($mail->parts) { my $subent = compress_mail($part); $ent->add_part($subent); } unlink $head; return $ent; } return $mail; }
any suggestion ...???

In reply to problem with size of reconstructed email by luckypower

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.