Net::IMAP::Simple

Discussion in 'Perl Misc' started by Joe Hasting, Jul 28, 2003.

  1. Joe Hasting

    Joe Hasting Guest

    I am re-posting to see if anyone has a suggestion, or experience using this
    module.:


    ------------------------------------------------------
    I would like to use the IMAP:Simple module to poll a IMAP server. I want to
    look at messages and search the subject and body for a string. I got the
    sample script from CPAN (below), but I can't get it to work. I changed
    someserver to my IMAP server, and someuser, somepassword, and somefolder to
    the appropriate values, but when I run it it returns immediatly with no
    responce (I can use a mail client and see me mesages in the folder on my
    IMAP server). Can someone let me know how I can check to see if I am
    logging into the server, or an alternate method that has worked for use to
    read IMAP.

    thanks
    J


    use Net::IMAP::Simple;


    # open a connection to the IMAP server
    $server = new Net::IMAP::Simple( $self->param( 'someserver' ) );

    # login
    $server->login( 'someuser', 'somepassword' );

    # select the desired folder
    $number_of_messages = select( 'somefolder' );

    # go through all the messages in the selected folder
    foreach $msg ( 1..$number_of_messages ) {

    # get the message
    $lines = $server->get( $msg );

    # print it
    print @$lines;
    }

    # the list of all folders
    @folders = $server->mailboxes();

    # create a folder
    $server->create_mailbox( 'newfolder' );

    # rename a folder
    $server->rename_mailbox( 'newfolder', 'renamedfolder' );

    # delete a folder
    $server->delete_mailbox( 'renamedfolder' );

    # copy a message to another folder
    $server->copy( $self, $msg, 'renamedfolder' );

    # close the connection
    $server->quit();
    Joe Hasting, Jul 28, 2003
    #1
    1. Advertising

  2. Joe Hasting

    Sam Holden Guest

    On Mon, 28 Jul 2003 11:30:09 -0400, Joe Hasting <> wrote:
    > I am re-posting to see if anyone has a suggestion, or experience using this
    > module.:


    Ask perl for help (by enabling warnings, and prevent silly errors
    by also using "use strict;").

    What do you think $self is? What does perl think it is? What makes
    you think it has a param method?

    It has been over *three and a half years* since the documentation
    of that module was corrected. Why are you still using the incorrect
    example (which was corrected *five days* after it was released)?

    [snip buggy example code from Net::IMAP::Simple 0.90 docs]

    That module hasn't been updated for a long time, if it works then
    I guess it'll do fine. But something like Mail::IMAPClient seems to
    be under more active development.

    --
    Sam Holden
    Sam Holden, Jul 28, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Henrik Ormåsen

    Curier-IMAP and imap.create()

    Henrik Ormåsen, Aug 19, 2006, in forum: Ruby
    Replies:
    0
    Views:
    175
    Henrik Ormåsen
    Aug 19, 2006
  2. Jon Fi
    Replies:
    4
    Views:
    521
    Kashia Buch
    Oct 21, 2006
  3. jasonnaylor
    Replies:
    1
    Views:
    247
    jasonnaylor
    Apr 16, 2008
  4. Abhishiv Saxena

    Support for IMAP IDLE in net/imap

    Abhishiv Saxena, Jul 3, 2009, in forum: Ruby
    Replies:
    4
    Views:
    190
    Eric Hodel
    Jul 4, 2009
  5. Abhishiv Saxena

    Support for IMAP IDLE in net/imap

    Abhishiv Saxena, Jul 3, 2009, in forum: Ruby
    Replies:
    0
    Views:
    229
    Abhishiv Saxena
    Jul 3, 2009
Loading...

Share This Page