#给163发送邮件import smtplibfrom email.mime.text import MIMETextnam=‘[email protected]‘send=‘[email protected]‘receive=‘[email protected]‘pw = ‘37193350d‘ #此密码有误,运行时需修改server=‘smtp.163.com‘port=0message=MIMEText(‘<p>这是网页正文</p>‘,‘html‘,‘utf-8‘)message[‘From‘]=‘xiatian‘message[‘To‘]=‘dongtian‘message[‘Subject‘]=‘big title‘smtp=smtplib.SMTP()smtp.connect(server,25)smtp.login(nam,pw)smtp.sendmail(send,receive,message.as_string())smtp.quit()print(‘邮件发送成功,请查收‘)
原文地址:https://www.cnblogs.com/canglongdao/p/12013291.html
时间: 2024-10-10 06:00:30