This shows you the differences between two versions of the page.
phone:gammu_send_sms [2011/06/07 09:56] flozz [Send SMS using Python] |
phone:gammu_send_sms [2017/09/01 12:24] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== How to send SMS with a computer running Linux and a cell phone ====== | ||
- | |||
- | {{ :phone:gammu_send_sms.png?320|Send an SMS from a computer running Linux}} | ||
- | |||
- | FIXME | ||
- | |||
- | |||
- | ===== Configuring Gammu ===== | ||
- | |||
- | FIXME | ||
- | |||
- | |||
- | ===== Send SMS from the command line ===== | ||
- | |||
- | FIXME | ||
- | |||
- | <code bash>echo "Hello world from my PC" | gammu sendsms TEXT <PhoneNumber></code> | ||
- | |||
- | ===== Send SMS using Python ===== | ||
- | |||
- | FIXME | ||
- | |||
- | <code python sendsms.py> | ||
- | #!/usr/bin/python | ||
- | # -*- coding: UTF-8 -*- | ||
- | |||
- | |||
- | import gammu | ||
- | |||
- | |||
- | gamu_sm = gammu.StateMachine() | ||
- | gamu_sm.ReadConfig() #Read the default config file (~/.gammurc) | ||
- | gamu_sm.Init() #Connect to the phone | ||
- | |||
- | gamu_sm.SendSMS({ #Send the SMS | ||
- | 'Class': 1, | ||
- | 'Text': "Hello World from my Python script :)", | ||
- | 'SMSC': {'Location': 1}, | ||
- | 'Number': "+336xxxxxxxx", | ||
- | }) | ||
- | |||
- | </code> | ||
- | ===== EXAMPLE: A simple Python application with a GTK2 GUI ===== | ||
- | |||
- | FIXME | ||