Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: Sending special characters to sms using Perl

by flexvault (Monsignor)
on Oct 23, 2012 at 16:26 UTC ( #1000496=note: print w/replies, xml ) Need Help??

in reply to Sending special characters to sms using Perl


I wrote this code in 2004/5. I would do it much different now, but it's worked since and I never even looked at it until your question. We monitor routers, switches, servers, etc. and it something doesn't respond correctly, we use the script to send a message to the support cell phone. The number in the sample is invalid.

#!/usr/local/bin/perl -w our $log = "/log/sms_emails"; open (CLOG, ">>$log") || die "Could not open-1 $log File\n"; our $ErrCode = "@ARGV"; if ( $ErrCode eq "" ) { print "format is: pyrsms.cgi message-text\n";exit(1); } $rno = time; $usermailmsg = "/tmp/SMS_msg_$rno"; $filout = "$usermailmsg"; open (f_out, ">$filout") || die "Could not open-3a $filout\n"; $PFemail = "9083972845\"; $ltm = localtime; print f_out "Subject: Error Code: $ErrCode\n\n\n"; close f_out; print CLOG "$ltm\t$PFemail\t$ErrCode\t$usermailmsg\n"; system("/usr/sbin/sendmail $PFemail < $usermailmsg"); sleep 1; system("/usr/sbin/sendmail -v -q 1>>/dev/null 2>>/dev/null");

Maybe something in the code will help you figure out what you need.

Good Luck!

"Well done is better than well said." - Benjamin Franklin

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1000496]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (8)
As of 2018-01-19 10:49 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (217 votes). Check out past polls.