My co-workers and I are occasionally forgetting to turn our Nextel phones on in the morning, and thus people have trouble reaching some of us for the 1st 2 hours of every Monday morning. Being admins, this is not a good thing. As I am occasionally guilty, I wrote this script to check to see if our Nextels are on before the boss reminds us, or something bad happens. To make the pages less annoying, I had it pull and send a stock price, too.

How it works

It reads the nextel number and SMTP address from a reads from a file, and does a group page. It then waits 45 seconds (I've found that 20 is plenty) and checks if each of the pages have been delivered individually. If not, it fires an e-mail to the specified SMTP address.

What you need

  1. A SMTP server to point to
  2. A file called pageme.txt conatining the phone numbers and SMTP addresses of those who want to use the script. in the format "phone#,SMTP address", one person per line. (E.g. 6175551212,


# 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, "<pageme.txt" or die "Can't open Phone list!"; while (<IN>){ chomp; my ($phone,$email)=split(/,/); $phonehash{$phone}=$email; } close IN; my $STT = get " +e=qd&Symbol=stt"; my ($price)=$STT=~/Last<\/TD><TD ALIGN=RIGHT NOWRAP><B>&nbsp;(\d+.\d ++)/; my $phonelist=join('%20',(sort keys %phonehash)); my $doc = get " +neWayPTNs=$phonelist&from=Perl&subject=Phone Check&message=Good Morni +ng! STT is currently $price"; my ($check)=$doc=~/"claimCheck" value="(\d+)"/; print "sent page (claim check: $check)\nwaiting 45 seconds to check re +ceipt...\n"; for (1..45){ sleep 1; print "$_." } foreach $key (sort keys %phonehash){ my $num=1; my $doc2= get " +us&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(); }

Update: mPageExt.dll was changed to ipageExt.dll by Nextle recently. Be sure to update accordingly (the script above was already corrected).