The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::IMAP::Simple::Gmail - Gmail specific support for Net::IMAP::Simple

SYNOPSIS

  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);
  }

DESCRIPTION

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.

METHODS

get_labels

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.

add_labels

$imap->add_labels($msgid, qw{accounts job});

Adds the labels to the selected message (labels must already exist).

remove_labels

$imap->remove_labels($msgid, qw{job});

Removes the labels from the selected message.

get_threadids

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.

SEE ALSO

Net::IMAP::Simple, perl.

AUTHOR

James Powell

COPYRIGHT

  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.