Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Get messages via IMAP with Perl?

by batkins (Chaplain)
on Mar 25, 2003 at 20:33 UTC ( [id://245775]=perlquestion: print w/replies, xml ) Need Help??

batkins has asked for the wisdom of the Perl Monks concerning the following question:

Is there any way to use Perl to access an IMAP server and retrieve the number of new messages? I looked through the Net::IMAP documentation, but couldn't find anything.

Title edit by tye

Replies are listed 'Best First'.
Re: IMAP
by defyance (Curate) on Mar 25, 2003 at 21:04 UTC
    In Net::IMAP CPAN docs, did you see this:

    * recent The number of messages with the \recent flag set.

    It is under the status $mailbox, @statusattrs heading. You may also want to look into Mail::IMAPClient. According to the docs, Mail::IMAPclient has a recent option as well.. Hope this helps you...

    UPDATE: A bit more verbose in reply.

    -- Can't never could do anything, so give me and inch, I'll make it a mile.

Re: IMAP
by jasonk (Parson) on Mar 25, 2003 at 21:02 UTC

    After you have authenticated to the IMAP server, you have to select() your inbox (normally called INBOX), one of the flags returned by select will be 'unseen', it's value will be the number of new messages in that box.

    Also, if you use the 'list' or 'lsub' commands to list mailboxes, they will return an unseen response as well.


    We're not surrounded, we're in a target-rich environment!
Re: IMAP
by jaldhar (Vicar) on Mar 25, 2003 at 21:05 UTC

    update: whoops the OP wants new messages. In that case you use the qty_recent method or query the unseen response directly.

    After logging in, authenticating, and selecting the mailbox, you want to use the qty_messages method. It returns the number of messages.

    --
    જલધર

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://245775]
Approved by valdez
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (5)
As of 2024-03-29 08:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found