I am trying to send messages to my phone using the SMTP protocol. If I log into my Google Account (for which I've enabled less secure apps) I'm able to send a message to '5551234567@tmomail.net'. The subject and body of the email arrive on my phone as a text message.
However, when I try to do the same with Python's smtplib
library, I don't get a message. Here's the code I'm using:
import smtplib
# Establish a secure session with gmail's outgoing SMTP server using your gmail account
server = smtplib.SMTP("smtp.gmail.com", 587)
server.starttls()
# the account that will send the emails
server.login('me@gmail.com', 'password')
# sendmail(from, to, msg)
server.sendmail('me@gmail.com', '5551234567@tmomail.net', 'hey there!')
Does anyone know what I can do to get the text message to come through from the smtplib
? Any suggestions are very welcome!