已经有一段时间没有使用python了,但是需要一个脚本来给自己发邮件提醒等等
为什么这样不行?在gmail告诉我一个不安全的应用试图访问后,我转而使用ssl。在
# Import smtplib for the actual sending function
import smtplib
# Import the email modules we'll need
from email.mime.text import MIMEText
msg = MIMEText("TEST FILE")
me = 'me@gmail.com'
you = me
msg['Subject'] = 'This is a test'
msg['From'] = me
msg['To'] = you
#username and password here
username = 'username'
password = 'password'
# Send the message via gmail with ssl
s = smtplib.SMTP_SSL('smtp.gmail.com:465')
s.login(username,password)
s.send_message(msg)
s.quit()
我尝试运行它时得到的错误如下:
^{pr2}$
目前没有回答
相关问题 更多 >
编程相关推荐