/usr/share/doc/libnet-imap-simple-perl/examples/search-test.pl is in libnet-imap-simple-perl 1.2207-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | #!/usr/bin/perl
use strict;
use Net::IMAP::Simple;
my $goog = login();
$goog->select("jet");
my @id1 = $goog->search(q(SUBJECT "rt.cpan.org #55177")); print "id1: @id1\n";
my @id2 = $goog->search(q(HEADER Message-ID "<rt-3.8.HEAD-12685-1267618808-430.55177-4-0@rt.cpan.org>")); print "id2: @id2\n";
$goog->put( jet => qq(from: jettero\@cpan.org\r\nMessage-ID: test-77\r\nsubject: test-77\r\n\r\ntest-77\r\n) );
$goog->put( jet => qq(from: jettero\@cpan.org\r\nMessage-ID: <test-77>\r\nsubject: <test-77>\r\n\r\n<test-77>\r\n) );
$goog->put( jet => qq(from: jettero\@cpan.org\r\nMessage-ID: <test-77\@hrm>\r\nsubject: <test-77\@hrm>\r\n\r\n<test-77\@hrm>\r\n) );
my @id3 = $goog->search(q(HEADER Message-ID "test-77")); print "id3: @id3\n";
my @id4 = $goog->search(q(HEADER Message-ID "<test-77>")); print "id4: @id4\n";
my @id5 = $goog->search(q(HEADER Message-ID "<test-77@hrm>")); print "id5: @id5\n";
my @id6 = $goog->search(q(SUBJECT "test-77")); print "id6: @id6\n";
# login {{{
sub login {
my $arg = ""; $arg = ".$_[0]" if $_[0];
my $fetchmailrc; { open my $in, "$ENV{HOME}/.fetchmailrc$arg" or die $!; local $/ = undef; $fetchmailrc = <$in>; close $in; }
my $server = $1 if $fetchmailrc =~ m/server\s+(.+)/m;
my $user = $1 if $fetchmailrc =~ m/user\s+(.+)/m;
my $pass = $1 if $fetchmailrc =~ m/pass\s+(.+)/m;
print "$server ";
my $debug = 1;
my $imap = Net::IMAP::Simple->new($server, debug=>$debug, use_ssl=>1) or die "connect failed: $Net::IMAP::Simple::errstr";
$imap->login($user=>$pass) or die "login failed: " . $imap->errstr;
print "[in] ";
return $imap;
}
# }}}
|