Last active
December 1, 2023 01:01
-
-
Save alexle/1294495 to your computer and use it in GitHub Desktop.
How to send a text message with python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# sms.py | |
# Sends sms message to any cell phone using gmail smtp gateway | |
# Written by Alex Le | |
import smtplib | |
# Use sms gateway provided by mobile carrier: | |
# at&t: [email protected] | |
# t-mobile: [email protected] | |
# verizon: [email protected] | |
# sprint: [email protected] | |
# Establish a secure session with gmail's outgoing SMTP server using your gmail account | |
server = smtplib.SMTP( "smtp.gmail.com", 587 ) | |
server.starttls() | |
server.login( '<gmail_address>', '<gmail_password>' ) | |
# Send text message through SMS gateway of destination number | |
server.sendmail( '<from>', '<number>@tmomail.net', '<msg>' ) |
For those interested, here is an implementation with multiple carriers + and async support: https://bit.ly/send-txt-msg
Do you guys know how to remove the subject when you send the text? Like the forward slashes? I just get / no subject / when I leave it blank
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I used this method and It worked great! Is there any way though that I can get the script to respond to a message in the conversation?