Net::IMAP::Simple::Gmail - Gmail specific support for Net::IMAP::Simple
use Net::IMAP::Simple::Gmail; my $server = 'imap.gmail.com'; my $imap = Net::IMAP::Simple::Gmail->new($server); $imap->login($user => $pass); my $nm = $imap->select('INBOX'); for(my $i = 1; $i <= $nm; $i++) { # Get labels on message my $labels = $imap->get_labels($msg); }
This module is a subclass of Net::IMAP::Simple::SSL that includes specific support for Gmail IMAP Extensions. Besides the gmail specific methods the interface is identical.
my $labels = $imap->get_labels($msgid); my $labels = $imap->get_labels('1:4');
If $msgid specifies one message (eg $msgid = 1), returns an arrayref of all labels on the message.
If $msgid is a range of messages (eg $msgid eq '1:4'), returns a hashref of all msgids => arrayref of labels.
$imap->add_labels($msgid, qw{accounts job});
Adds the labels to the selected message (labels must already exist).
$imap->remove_labels($msgid, qw{job});
Removes the labels from the selected message.
my $threadid = $imap->get_threadids($msgid); my $threadids = $imap->get_threadids('1:10');
If $msgid specifies one message (eg $msgid = 1), returns a string containing the Gmail threadid.
If $msgid is a range of messages (eg $msgid eq '1:4'), returns a hashref of all msgids => threadids;
my $run_search = $imap->run_search('Perl');
Returns an array of msgids matching the search terms.
Net::IMAP::Simple, perl.
James Powell
Copyright (c) 2013 James Powell. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Net::IMAP::Simple::Gmail, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::IMAP::Simple::Gmail
CPAN shell
perl -MCPAN -e shell install Net::IMAP::Simple::Gmail
For more information on module installation, please visit the detailed CPAN module installation guide.