Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re: Sending special characters to sms using Perl

by flexvault (Prior)
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

Comment on Re: Sending special characters to sms using Perl
Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1000496]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2015-11-28 09:31 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (740 votes), past polls