Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

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]
[Corion]: marto: Oh ;) Well, I think you did right - more time, even if not spent with the kids directly, is still more time for you.

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2017-06-29 08:34 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (655 votes). Check out past polls.