#coding: utf-8
import smtplib
from email.mime.text import MIMEText
from email.header import Header
'
subject = 'python email test2'
smtpserver = 'smtp.163.com'
username = '×××'
password = '×××41 # 授權碼,不是密碼','text','utf-8')#中文需參數'utf-8',單字節字元不需要
msg['Subject'] = Header(subject, 'utf-8')
msg[" To"]=receiver
smtp = smtplib.SMTP()
smtp.connect('smtp.163.com')
smtp.login(username, password)
etp.sendmail(s99.
smtp.quit()
------------如果passwd不是授權碼的話,報錯如下-------------------
jack @jack-desktop:~/work/script/test$ python testemai.py
Traceback (most recent call last):
File "testemai.py", line 19, in
sm.
File "/home/jack/anaconda/lib/python2.7/smtplib.py", line 622, in login
raise SMTPAuthenticationError(code, resp) 5,57566 月jack@jack-desktop:~/work/script/test$ python testemai.py
Traceback (most recent call last):
File "testemai.py", line 19, in
File "/home/jack/anaconda/lib/python2.7/smtplib.py", line 622, in login
raise SMTPAuthenticationError(代碼