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 '[email protected]'. 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('[email protected]', 'password')
# sendmail(from, to, msg)
server.sendmail('[email protected]', '[email protected]', '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!