Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??


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).


In reply to Is your Nextel on? Why not check? by OzzyOsbourne

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2022-09-29 05:42 GMT
Find Nodes?
    Voting Booth?
    I prefer my indexes to start at:

    Results (125 votes). Check out past polls.