Hello there,
I am a newbie when it comes to Perl. I need to retrieve message subject lines from a POP3 mailbox. I have started out using Net:
OP3 to authenticate and get the number of messages in the POP3 mailbox. I used the following code to accomplish this:
What I want to do is to parse out the subject lines from all messages in the inbox, then be able to use the data contained within them to use in my script. The subject lines are comma separated so it should be pretty easy to extract the data I want once I get the data. Please help!!
I am a newbie when it comes to Perl. I need to retrieve message subject lines from a POP3 mailbox. I have started out using Net:
Code:
#!/usr/local/bin/perl
#
use Net::POP3;
#################POP Mail Settings########################
# $srcemail = Source Email Address for alerts to be sourced from
# $dstemail = Destination Email Address for alerts to be sent to
# $mailsrvr = SMTP Server to be used to send the mail through
# $rplyto = Address to which any reply for the alert will be sent
############################################################
$host = '[mail server]';
$user = "[email address]";
$pass = '[account password]';
# Retrieve Mail.
# initiate connection
# default timeout = 120 sec
$conn = Net::POP3->new($host) or die("ERROR: Unable to connect.\n");
# login
$numMsg = $conn->login($user, $pass) or die("ERROR: Unable to login.\n");
# display number of messages
if ($numMsg > 0) {
print "Mailbox has $numMsg message(s).\n";
}
else {
print "Mailbox is empty.\n";
}
# close connection
$conn->quit();
What I want to do is to parse out the subject lines from all messages in the inbox, then be able to use the data contained within them to use in my script. The subject lines are comma separated so it should be pretty easy to extract the data I want once I get the data. Please help!!