Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- #
- # using pop3get -c will leave the mail on the server.
- #
- use Net::POP3;
- use Mail::Message;
- use Getopt::Long;
- use Date::Manip;
- use DateTime::Format::Strptime;
- use warnings;
- use strict;
- use vars qw($opt_c);
- GetOptions("c!");
- my $ServerName = "mail.net";
- my $pop3 = Net::POP3->new($ServerName, Debug => 0);
- my $UserName = "xxx";
- my $Password = "xxxx";
- my $inbox = "/tmp/";
- my $msg_id;
- my $email_dir = "/var/www/jc/";
- die "Couldn't log on to server" unless $pop3;
- my $Num_Messages = $pop3->login($UserName, $Password);
- my $Messages = $pop3->list();
- for $msg_id (keys(%$Messages)) {
- print "Retriving Msg: $msg_id\n";
- my $MsgContent = $pop3->get($msg_id);
- my $DATE;
- my $rawdata = $pop3->get($msg_id);
- my $msg_obj = Mail::Message->read($rawdata);
- my $body = $msg_obj->body;
- print $body;
- }
- $pop3->quit();
Add Comment
Please, Sign In to add comment