Tomas wrote:
Hi list,

I was wondering is there any way to send SMS messages from OpenBSD OS? May be there is any program to do such task?

You could use Google's online SMS service. It's not directly from your OBSD box, but it can get the job done. Here are a couple of scripts I wrote a long time ago for someone, which do not currently work because Google has changed the URL and form variables. Nonetheless, it should give you some ideas. Google's new SMS service is at http://www.google.com/sendtophone.

==================================

#!/usr/local/bin/ruby
require 'net/http'
require 'uri'

qs = {
  'carriersms' => 'SPRINT',
  'client' => 'firefox_sms_but',
  'numsms' => '5551234567',
  'msgsms' => STDIN.gets.chomp

}.map { |x,y| x + '=' + URI::encode(y) }.join('&')

Net::HTTP.start('sms.toolbar.google.com') do |http|
  response = http.get("/send/sms?#{qs}")
  # check Net::HTTPResponse & retry if needed
end

==================================

(the shell script below uses FBSD's ``fetch''; you would need to find an equivalent command in OBSD.)

#!/bin/sh
sms="http://sms.toolbar.google.com/send/sms";
num='5551234567' # 10 digit phone num
car='SPRINT'     # Select your carrier
msg=`cat`        # read stdin
tmp=`mktemp /tmp/request.XXXXX`

fetch -qaw3 -o $tmp
"${sms}?client=firefox_sms_but&numsms=${num}&carriersms=${car}&msgsms=${msg}"
rm -f $tmp

==================================

The scripts read stdin, so you could do something like this:
$ sh sms.sh < message

I believe a newline, encountered in your error message, will truncate
your message prematurely.

Here are the list of carriers (there are many more now, just read the HTML source at http://www.google.com/sendtophone):
ALLTEL|ATT|CELLULARONE|CINGULAR|NEXTEL
OMNIPOINT|QWEST|SPRINT|TMOBILE|VERIZON|VIRGIN

One last consideration, make sure you don't send sensitive data over
this unencrypted transmission.

-pachl

Reply via email to