#!c:/perl/bin/perl.exe -w use strict; use Mail::POP3Client; use Win32::Sound; my $precnt = 0; if(!$ARGV[0] || !$ARGV[1] || !$ARGV[2] || !$ARGV[3] || !$ARGV[4]) { print "Usage : $0 [server] [username] [password] [sleep time] [wav file]\n"; exit(1); } while(1) { &daemon($ARGV[0],$ARGV[1],$ARGV[2]); print "Sleep for $ARGV[3]\n"; sleep($ARGV[3]); } sub daemon { my ($server,$user,$pwd) = @_; my $pop = new Mail::POP3Client( USER => "$user", PASSWORD => "$pwd", HOST => "$server" ); my $cnt = $pop->Count; $pop->Close; if($cnt == -1) { print "Error in connecting to the POP3 server...\n"; return; } print "You have $cnt new messages\n"; if($cnt > $precnt) { Win32::Sound::Play("$ARGV[4]"); Win32::Sound::Stop; } $precnt = $cnt; }