Send SMS using Python Gammu

By deptz, Fri. December 10, 2010
Categories: computer related, handphone, tutorial
Tags: , , ,
534 views

Gammu is a command line utility for controlling a phone (or modem) written in C. Gammu can be used for phone management software or maybe a SMS Gateway. Gammu can manage SMS, MMS, Phonebook, Calendar, phone’s file system and Call.

Today, i try to install Gammu and Python Gammu on Ubuntu 10.10 Maverick. Then, i write some code to send sms using command line.

#!/usr/bin/env python
import gammu
import sys

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

message = { 
'Text' : sys.argv[1], 
'SMSC': {'Location': 1}, 
'Number': sys.argv[2],
}

sm.SendSMS(message)

save it as sms.py,
To use this script, just type: python sms.py “message” “number-to”

🙂

5 Responses to “Send SMS using Python Gammu”

  1. tege Says:

    ajari kakak, ini apa an to?

    coba ah…

  2. d3ptzz Says:

    @tege: haha.. ini iseng2 saja

  3. namakukingkong Says:

    wuh om deptzz ngeri tok……bikin sms getway neh……..

  4. d3ptzz Says:

    @namakukingkong: belum sampai tahap itu bro..:)) nanti mungkin mohon bimbingan python..haha..

  5. ganda Says:

    bro, gimana dengan family tree?

Comments