Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/perl
- use Mail::POP3Client;
- use IO::Socket::SSL;
- use CGI qw(:standard);
- $cgi = new CGI;
- $info = 'liberty';
- $username = 'champ1';
- $password = 'kommerikkedigved';
- $mailhost = 'pop.gmail.com'; #examplepop.gmail.com
- $port = '995'; #995
- print $cgi->header();
- $pop = Mail::POP3Client->new(USER => $username,
- PASSWORD => $password,
- HOST => $mailhost,
- PORT => $port,
- USESSL => 'true',
- DEBUG => 0,) or die("ERROR: Unable to connect to mail server.\n");
- my $count = $pop->Count();
- if (($pop->Count()) < 1)
- {
- print "No messages...\n";
- exit;
- }
- print "There are $count Messages in your inbox\n";
- for(my $i = 1; $i <= $pop->Count(); $i++)
- {
- foreach($pop->Head($i))
- {
- if ($pop eq "$info" )
- {
- print "\n\n\nMail number $i\n";
- print $info() ."\n";
- /^(From|Subject|Email):\s+/i && print $_, "\n";
- print 'Message: '.$pop->Body($i);
- }
- }
- }
- $pop->Close();
- exit;
Add Comment
Please, Sign In to add comment