Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to check for new mail using perl??

Status
Not open for further replies.

kwi

IS-IT--Management
Mar 20, 2001
2
US
Hi
I am using Mail::pop3Client module to get messages from the server. Is there a way that I can get only new messages using this module or using any other modules???
 
if you do:

#!/usr/local/bin/perl


use Mail::pOP3Client;

$pop = new Mail::pOP3Client( USER => "me",
PASSWORD => "mypassword",
HOST => "pop3.do.main" );
for ($i = 1; $i <= $pop->Count(); $i++) {
foreach ( $pop->HeadAndBody( $i ) ) {
print $_, &quot;\n&quot;; # and then save it somewhere
Delete($i);
}
print &quot;\n&quot;;

that will retreive and delete all messages in the mailbox, next time you look there will be inly new emails in there Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top