![Python发送邮件脚本 Python发送邮件脚本](https://image.shishitao.com:8440/aHR0cHM6Ly9ia3FzaW1nLmlrYWZhbi5jb20vdXBsb2FkL2NoYXRncHQtcy5wbmc%2FIQ%3D%3D.png?!?w=700&webp=1)
import smtplib
from email.mime.text import MIMEText
mailserver = "smtp.163.com"
username_send = 'tccwpl@163.com'
password = '邮箱的客户端授权码'
username_recv = '996214487@qq.com'
mail = MIMEText('彭彭你好哇')
mail['Subject'] = '彭彭'
mail['From'] = username_send
mail['To'] = username_recv
smtp = smtplib.SMTP(mailserver,port=25)
# smtp=smtplib.SMTP_SSL('smtp.qq.com',port=465)
smtp.login(username_send,password)
smtp.sendmail(username_send,username_recv,mail.as_string())
smtp.quit()
print ('success')