Here’s a script to send a text message in Python. It uses the standard library and is very straightforward. It utilizes the fact that most major carriers allow texting via email (ie. by SMTP), so nothing more is needed than an email account and a desired target.
In my work, I use it to tell me when my computational simulations are done running. Also, it can send to any phone number and can be put in an infinite loop – days of fun, right there.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
import smtplib from email.mime.text import MIMEText # Message to be sent message = MIMEText("Hello, texting!") # Sending email username/password and receiving phone number email_username = "" email_password = "" phone_number = "" # Gmail to Verizon. Change here for different combinations. email_username += "@gmail.com" phone_number += "@vtext.com" # Format message to look like an email message["From"] = email_username message["To"] = phone_number message["Subject"] = "From your server!" # Connect and send s = smtplib.SMTP('smtp.gmail.com:587') s.starttls() s.login(email_username, email_password) s.sendmail(email_username, phone_number, message.as_string()) s.quit() |
This works great. Thanks!
I can’t seem to find an online texting service for Wind. Are you considering that one of the “major” carriers?
Sadly, it looks like Wind is not one of the “major” carriers. Someone reported having success with “@msg.wind.ca” (http://www.howardforums.com/showthread.php/1626457-Does-WIND-Have-Emails-to-SMS), but it seems that it’s generally unsupported.