如何使用Python发送以Gmail为提供者的电子邮件?
Traceback (most recent call last): File "emailSend.py", line 14, in <module> server.login(username,password) File "/usr/lib/python2.5/smtplib.py", line 554, in login raise SMTPException("SMTP AUTH extension not supported by server.") smtplib.SMTPException: SMTP AUTH extension not supported by server.
import smtplib fromaddr = 'user_me@gmail.com'toaddrs = 'user_you@gmail.com'msg = 'Why,Oh why!'username = 'user_me@gmail.com'password = 'pwd'server = smtplib.SMTP('smtp.gmail.com:587')server.starttls()server.login(username,password)server.sendmail(fromaddr, toaddrs, msg)server.quit()
相关分类