Skip to main content

Send SMS via Gmail SMTP servers.

Project description



pysendsms is a quick and simple way to use python to send SMS via Gmail or any other SMTP servers to known a cell carrier.


Use the package manager pip to install pysendsms.

pip install pysendsms


Note: Other SMTP servers can be used, however configuration varies by providers. Gmail is setup to work by default just requiring email and password.

  • Knowledge of which cell carrier provider the receiving party uses.


Import the library and create an SMS Object utilizing your gmail account and an application password created within your Google account.

import pysendsms

sms = pysendsms.SMS('<username>', '<app-password>')

SMS object has various parameters allowing you to use some other SMTP providers of your choice.

sms = pysendsms.SMS(self,
		password= '<app-password>',

Note: If using an SMTP API and you are given a username that is not an email address, you must provide the a verified from_email parameter otherwise outgoing mail with fail.

Create an Contact object using the persons phone number and select a carrier from the available options.

CARRIERS is a dictionary loaded from a json file in the project that can be checked for available carriers that can be used for messaging.

>>> pysendsms.Contact('2715552343', 'AT&T')
<Contact('2715552343', '')>

A Contact can also be created with a known address using the by_address class method.

>>> pysendsms.Contact.by_address('')

Note: Given the nature of this capability, you are able to just add any email address here and not one linked to a phone number for standard SMTP emailing functionality.

Use the SMS.send() method of your SMS object, passing the Contact and the message you would like to send as a string. This can also accept a list of contacts for sending out group messages.

contact1 = pysendsms.Contact('311-555-2368', 'AT&T')

sms.send(contact1, 'Hello, World!')

contact2 = pysendsms.Contact.by_address('')

group = [contact1, contact2]

sms.send(group, 'Everyone gets a message!')



Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pysendsms-0.2.1.tar.gz (9.1 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page