Skip to content
Send text messages from python
Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
README.md
carriers.sql
csv_to_dict.py
example.py
gateways.py
sender.py
us_gateways.csv

README.md

PyMS

Send text messages from python

Usage

As found in example.py

from gateways import GATEWAYS
from sender import PyMS

pyms = PyMS()
pyms.connect()
pyms.send_sms('1234567890', GATEWAYS['SPRINT']['SMS_EMAIL'], "Test")
pyms.disconnect()

Defaults

PyMS uses a few default settings to make this all work. The following inputs can be provided to PyMS(...)

  • username the account username in the form username@domain.com. Defaults to system environment variable PYMS_USERNAME
  • password the password for the account. Defaults to system environment variable PYMS_PASSWORD
  • host the SMTP server hostname. Defaults to smtp.gmail.com
  • port the SMTP server port. Defaults to 465

Gmail

As found out from radtek on Stack Overflow, you need to allow your Gmail account to work with a less secure app by flipping a switch here https://www.google.com/settings/security/lesssecureapps as this type of login is considered unsecure

Gateways

PyMS uses SMS / MMS gateways to deliver messages to a mobile device. Most US carriers should be provided in the GATEWAYS dict in gateways.py for usage. These gateways taken from here

Drawbacks

Currently the carrier of the mobile device must be known to send a message

This may be overcome by hitting http://www.fonefinder.net/ and scraping the results however it presents issues if a user changes there carrier but maintains the same phone number. Most other services are paid for including any API's that exist.

You can’t perform that action at this time.