# Opens pageme.txt, and sends a group page to those listed. # It then sends an e-mail to those that don't get the page. use strict; use LWP::Simple; my (%phonehash,$key); open IN, "){ chomp; my ($phone,$email)=split(/,/); $phonehash{$phone}=$email; } close IN; my $STT = get "http://moneycentral.msn.com/scripts/webquote.dll?iPage=qd&Symbol=stt"; my ($price)=$STT=~/Last<\/TD> (\d+.\d+)/; my $phonelist=join('%20',(sort keys %phonehash)); my $doc = get "http://messaging.nextel.com/cgi/iPageExt.dll?sendPage&oneWayPTNs=$phonelist&from=Perl&subject=Phone Check&message=Good Morning! STT is currently $price"; my ($check)=$doc=~/"claimCheck" value="(\d+)"/; print "sent page (claim check: $check)\nwaiting 45 seconds to check receipt...\n"; for (1..45){ sleep 1; print "$_." } foreach $key (sort keys %phonehash){ my $num=1; my $doc2= get "http://messaging.nextel.com/cgi/iPageExt.dll?pageStatus&claimCheck=$check&phone$num=$key&StatusCheck=1"; if ($doc2=~/Delivered/){ print "Delivered OK"; }else{ print OUT "Coudn't deliver page. Sending e-mail notification\n"; &SendEmail($phonehash{$key},$key); } $num++; } sub SendEmail { use Net::SMTP; my ($email,$phone)=@_; my $smtp = Net::SMTP->new('server'); $smtp->mail($ENV{USER}); $smtp->to("$email"); $smtp->data(); $smtp->datasend("From: Perl\n"); $smtp->datasend("Subject: Nextel\n"); $smtp->datasend("\n"); $smtp->datasend("Your phone (#$phone) appears to be off. You will get a test page when you turn it on.\n"); $smtp->dataend(); }