import smtplib
from email.mime.text import MIMEText
# 收件人列表
mail_list = ["xxxx@qq.com","xxx@xx.cn","xxxx@163.com"]
# 发送方信息
mail_user = "18601720111@163.com"
#口令
mail_pass = "S4545520"
#发送邮件
#title:标题
#content:内容
def send_qq_email(title,content):
try:
msg = MIMEText(str(content))
#设置标题
msg["Subject"] = title
# 发件邮箱
msg["From"] = mail_user
#收件邮箱
msg["To"] = ";".join(mail_list)
# 设置服务器、端口
s = smtplib.SMTP_SSL("smtp.163.com", 465)
#登录邮箱
s.login(mail_user, mail_pass)
# 发送邮件
s.sendmail(mail_user, mail_list, msg.as_string())
s.quit()
print("邮件发送成功!")
return True
except smtplib.SMTPException:
print("邮件发送失败!")
return False
send_qq_email("明天会务","请明天及时回复我")