mail-to-sms
Programmatically send out text messages via email.
Installation
pip install mail_to_sms and import like any other Python module. Or,
git clone https://github.com/naschorr/mail-to-sms locally as needed. Make sure to install the requirements with pip install -r requirements.txt
Arguments
number {string|int}: The destination phone number (ex. 5551234567).
carrier {string}: The destination phone number’s carrier (ex. "att"). Current carriers are include: alltel, att, boost mobile, cricket wireless, metropcs, project fi, sprint, tmobile, us cellular, verizon wireless, virgin mobile.
username {string} [optional]: The username for accessing the SMTP server (ex. "username"). If omitted, it’ll try to use the username stored in the .yagmail file.
password {string} [optional]: The password for accessing the SMTP server (ex. "password"). If using Gmail and 2FA, you may want to use an app password. If omitted, it’ll try to use yagmail’s password in the keyring, otherwise it’ll prompt you for the password.
contents {*yagmail contents*} [optional]: A yagmail friendly contents argument (ex. "This is a message."). If omitted, MailToSMS’s send() method can be called manually.
keyworded args (for extra configuration):
quiet {boolean}: Choose to disable printed statements. Defaults to False. (ex. quiet=True)
region {string}: The region of the destination phone number. Defaults to “US”. (ex. region="US"). This should only be necessary when using a non international phone number that’s not US based. See the phonenumbers repo here.
mms {boolean}: Choose to send a MMS message instead of a SMS message, but will fallback to SMS if MMS isn’t present. Defaults to False. (ex. mms=True)
subject {string}: The subject of the email to send (ex. subject="This is a subject.")
yagmail {list}: A list of arguments to send to the yagmail.SMTP() constructor. (ex. yagmail=["my.smtp.server.com", "12345"]). As of 4/30/17, the args and their defaults (after the username and password) are host='smtp.gmail.com', port='587', smtp_starttls=True, smtp_set_debuglevel=0, smtp_skip_login=False, encoding="utf-8". This is unnecessary if you’re planning on using the basic Gmail interface, in which case you’ll just need the username and password. This may make more sense if you look at yagmail’s SMTP class here.
Examples
from mail_to_sms import MailToSMS
MailToSMS(5551234567, "att", "username@gmail.com", "password", "this is a message")
MailToSMS("5551234567", "att", "username", "password", ["hello", "world"], subject="hey!")
MailToSMS(5551234567, "att", "username", "password", "hello world!", yagmail=["smtp.gmail.com", "587"])
MailToSMS("5551234567", "att", "username@gmail.com", "password", ["line one"], yagmail=["smtp.gmail.com"])
mail = MailToSMS(5551234567, "att", "username", "password")
mail.send("this is a string!")
Requirements
click (for the CLI)
Note
I’ve only been able to test this on AT&T, so I can’t guarantee that this works for other carriers. Feedback is appreciated.
Metadata
Release files for mail_to_sms 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mail_to_sms-0.3.1.tar.gz | 7.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mail_to_sms-0.3.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 17.3 kB
Release files / mail_to_sms-0.3.1.tar.gz
| Download URL | mail_to_sms-0.3.1.tar.gz |
|---|---|
| Size | 7.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
11fe97cccef90064cea666f7bcb95b252873011ccb9da1c6ac019410b98b02ea
|
|
BLAKE2b-256 checksum How to use checksums |
a642ab07fd682b82bc585b32948101bd95da2eb600b26174a6e9d693e5e5baef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / mail_to_sms-0.3.1-py2.py3-none-any.whl
| Download URL | mail_to_sms-0.3.1-py2.py3-none-any.whl |
|---|---|
| Size | 10.0 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
371648a83ff30e7cad55e5118426a28b428ff4e5d93c983244398e55d887e740
|
|
BLAKE2b-256 checksum How to use checksums |
ae91961cf97ea6c2ebe2bf5dbcf28bc7413a6f7788479dc8c7a66c947482cda2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |