python smtplib邮件发送程序

python smtplib邮件发送程序


import smtplib
from email.mime.text import MIMEText

msg_from="xx"
pwd=""
to="xx"

subject="python邮件版"
conntent="xxxx"

msg=MIMEText(conntent)
msg["Subject"]=subject
msg["From"]=msg_from
msg["To"]=to

ss=smtplib.SMTP_SSL("smtp.163.com",465)
ss.login(msg_from,pwd)
ss.sendmail(msg_from,to,msg.as_string())