Guest User

Untitled

a guest
Jun 20th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. #!/bin/perl
  2.  
  3. use Mail::POP3Client;
  4. use IO::Socket::SSL;
  5. use CGI qw(:standard);
  6. $cgi = new CGI;
  7.  
  8. $info = 'liberty';
  9. $username = 'champ1';
  10. $password = 'kommerikkedigved';
  11.  
  12. $mailhost = 'pop.gmail.com'; #examplepop.gmail.com
  13. $port = '995'; #995
  14.  
  15. print $cgi->header();
  16.  
  17. $pop = Mail::POP3Client->new(USER => $username,
  18. PASSWORD => $password,
  19. HOST => $mailhost,
  20. PORT => $port,
  21. USESSL => 'true',
  22. DEBUG => 0,) or die("ERROR: Unable to connect to mail server.\n");
  23.  
  24. my $count = $pop->Count();
  25.  
  26. if (($pop->Count()) < 1)
  27. {
  28. print "No messages...\n";
  29. exit;
  30. }
  31.  
  32.  
  33. print "There are $count Messages in your inbox\n";
  34.  
  35.  
  36. for(my $i = 1; $i <= $pop->Count(); $i++)
  37. {
  38. foreach($pop->Head($i))
  39. {
  40. if ($pop eq "$info" )
  41. {
  42. print "\n\n\nMail number $i\n";
  43. print $info() ."\n";
  44. /^(From|Subject|Email):\s+/i && print $_, "\n";
  45. print 'Message: '.$pop->Body($i);
  46. }
  47. }
  48. }
  49.  
  50. $pop->Close();
  51.  
  52. exit;
Add Comment
Please, Sign In to add comment