Skip to main content

Python Send SMS via Cellphone

I'm Impressed with Python-gammu, after gammu was released i was building a python program passing to the hole via AT Commands trough Com ports of a computer to a mobile phone but it was a messed spending hours every day, although got a success in learning AT Commands it was a headache.

What do you need:
  • Mobile Phone(of course) i used SE T230, you ca use SE T series, or Nokia Old Models or the best is the benq S series
  • You need a Python 2.4 or 2.5 runs with Linux or Windows(headache)
  • Python-gammu 1.6 to 2.0, ei dont use 2.1 up for those who use fedora 7 or suse 10.2, it will give you a headache
  • A bluetooth if you require a bluetooth transmission than a cable.
Assuming you installed gammu successfully
  • edit /etc/gammurc
  • port = ttys0:
    model = se T230
    connection = at
  • Note port if located at /dev/ to know what device is that got to /dev ls the folder remember all the files, plugin your phone to usb then a file will come out, that would be you port
  • finish
This Will be your code in python

import gammu

sm = gammu.StateMachine()
sm.ReadConfig()
sm.Init()

status = sm.GetSMSStatus()

remain = status['SIMUsed'] + status['PhoneUsed'] + status['TemplatesUsed']

start = True

while remain > 0:
if start:
sms = sm.GetNextSMS(Start = True, Folder = 0)
start = False
else:
sms = sm.GetNextSMS(Location = sms[0]['Location'], Folder = 0)
remain = remain - len(sms)

for m in sms:
print
print '%-15s: %s' % ('Number', m['Number'])
print '%-15s: %s' % ('Date', str(m['DateTime']))
print '%-15s: %s' % ('State', m['State'])
print '\n%s' % m['Text']

Comments

Popular posts from this blog

Automated Testing with Behat & Mink on Linux

Have time to read my introduction. Behat + Mink + Selenium Server will do the automatic testing for your website. Behat handles your test cases in a form of a sentence which consist of the following Feature - which is a description of your test case. Example is "Title Checking" Scenario - Feature consist of Scenario's Conditions - Scenario's consist of condition using the following tags "Given", "When", "Then", "And", "But" Example feature:  Feature: Google Search @javascript Scenario: Check Google Site When I go to " http://www.google.com " Then Capture a ScreenShot @javascript Scenario: Search Efren on Google Given I am on " http://www.google.com " When I input "Efren" in " gbqfq" element When press " Google Search " Then print current URL Then Capture a ScreenShot You need t

take a snapshot online via your webcam

I'm fully newbie on flash but I manage to mix php and flash, i had a client which prefer a web cam app online, well that was 2007 ago, but when i notice y flash had this feature accessing a client web cam i was thinking if i can do some snapshot on it. well I've done it. to those who needs my app email me or leave you email here. well i might come out with free version but maybe with some banners on just for the just for a credit on my own. and also to those who wants some sample I can update my site upon your request.

Initial Installation of RoR Centos, Fedora, Redhat

# yum install ruby # y um install gcc g++ make automake autoconf curl-devel openssl-devel zlib-devel httpd-devel apr-devel apr-util-devel sqlite-devel # yum install ruby-rdoc ruby-devel # y um install rubygems # mkdir ~/src # cd ~/src # wget http://production.cf.rubygems.org/rubygems/rubygems-2.2.2.tgz # cd rubygems-1.3.6 # ruby setup.rb Install Rails # gem update # gem update --system # gem install rails # gem install rails -V -----DONE