I am trying to move folders to an "old_messages" folder after i have read and stripped the attachments from them but when i do it all of the messages it sends to the "old_messages" folder are blank and from "unknown sender" and the inbox is unchanged I checked around and nobody seems to have had this problem before (p.s. I graduated college a month ago during which i didn't even touch Perl and now i have been working with it for a whole 3 weeks so i apologize if this seems like an obvious fix).

use strict; use warnings; # required modules use Net::IMAP::Simple; use Email::MIME; use IO::Socket::SSL; use Email::MIME::Attachment::Stripper;
###IMAP connecting here### my $nm = $imap->select('INBOX'); for ( my $i = 1 ; $i <= $nm ; $i++ ) { if (!$imap->seen($i) ) { next; } else { my $es = Email::MIME->new( join '', @{ $imap->get($i) } ); my $text = $es->body; my $stripper = Email::MIME::Attachment::Stripper->new($es); my @attachments = $stripper->attachments; my $l = 0; foreach $_(@attachments) { my $url = ""; my $fh = IO::File->new(); open($fh, '>', "$filepath"."$_->{filename}"); binmode($fh); print $fh "$_->{payload}\n"; $fh->close; } $imap->put( 'OLD_MESSAGES', $es, "") or warn $imap->errstr; } }

In reply to Moving gmail messages with net::imap::simple by anonymonk

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.