Skip to main content

Image

PySendSMS

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.

Installation

Use the package manager pip to install pysendsms.

pip install pysendsms

Requires

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.

Usage

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>@gmail.com', '<app-password>')

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

sms = pysendsms.SMS(self,
		username='<username>@gmail.com',
		password= '<app-password>',
		from_email=None,
		server='smtp.gmail.com',
		port=587,
		tls=True)

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', '@mms.att.net')>

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

>>> pysendsms.Contact.by_address('2715552343@mms.att.com')
<Contact('2715552343@mms.att.com')>

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('3115552368@mms.att.net')

group = [contact1, contact2]

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

License

MIT

Release files for pysendsms 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pysendsms 0.2.1
File Size Uploaded
pysendsms-0.2.1.tar.gz 9.1 kB Details

Release files / pysendsms-0.2.1.tar.gz

Download URL pysendsms-0.2.1.tar.gz
Size 9.1 kB
Tags Source
SHA-256 checksum
How to use checksums
f36c38b5397b92df5b5ad5ec9cb755ebce1207e884367e0ccc7675a6e471fefd
BLAKE2b-256 checksum
How to use checksums
bd32d701237fb6369ae7d9223ad1a38862687501aeece86174fbc56b5bd7ecd1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2

Release history Release notifications | RSS feed

This release

0.2.1 This release

1 release file

0.2.0

1 release file

0.1.8

1 release file

0.1.7

1 release file

0.1.6

1 release file

0.1.5

1 release file

0.1.4

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page