Net::Async::IMAP::Client - asynchronous IMAP client based on Protocol::IMAP::Client and IO::Async::Protocol::Stream.
use IO::Async::Loop; use Net::Async::IMAP; my $loop = IO::Async::Loop->new; my $imap = Net::Async::IMAP::Client->new( loop => $loop, host => 'mailserver.com', service => 10143, # custom port number example user => 'user@mailserver.com', pass => 'password',
# Automatically retrieve any new messages that arrive on the server on_message_received => sub { my ($self, $id) = @_; $self->fetch($id); },
# Display the subject whenever we have a successful FETCH command on_message => sub { my ($self, $msg) = @_; warn "Had message " . Email::Simple->new($msg)->header('Subject') . "\n"; }, ); $loop->loop_forever;
Provides support for communicating with IMAP servers under IO::Async.
See Protocol::IMAP for more details on this implementation of IMAP, and RFC3501 for the official protocol specification.
Instantiate a new object. Will add to the event loop if the loop parameter is passed.
Pass any new data into the protocol handler.
Apply callbacks and other parameters, preparing state for event loop start.
Prepare and activate a new transport.
Upgrade the underlying stream to use TLS.
Restart the idle timer.
Disable the timer if it's running.
Set up the connection automatically when we are added to the loop.
TODO: this is probably the wrong way to go about things, move this somewhere more appropriate.
TODO(pe): Ish... It would be nice if the IO::Async::Protocol could manage an automatic ->connect call
Tom Molesworth <net-async-imap@entitymodel.com>
Copyright Tom Molesworth 2010-2011. Licensed under the same terms as Perl itself.
To install Net::Async::IMAP, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Async::IMAP
CPAN shell
perl -MCPAN -e shell install Net::Async::IMAP
For more information on module installation, please visit the detailed CPAN module installation guide.