直接给代码:
# 导入yagmail第三方库
import yagmail
# yagmail.SMTP(user="邮箱名",host="SMTP服务器域名")
yag = yagmail.SMTP(user="284036658@qq.com", host="smtp.qq.com")
# 正文内容
contents = ["当年万里觅封侯。", "匹马戍梁州。",
"关河梦断何处,", "尘暗旧貂裘。",
yagmail.inline(r"C:\\Users\TYC\Desktop\1.jfif"),
"<a href='https://baike.baidu.com/item/%E8%AF%89%E8%A1%B7%E6%83%85%C2%B7%E5%BD%93%E5%B9%B4%E4%B8%87%E9%87%8C%E8%A7%85%E5%B0%81%E4%BE%AF/7253076?fr=aladdin'>链接</a>"
]
subject = "诉衷情·当年万里觅封侯"
# 发送邮件 yag.send("收件人",邮件标题,邮件内容)
more_mail = ["284036658@qq.com","786631923@qq.com"] #还可以添加更多收件人
yag.send(more_mail, subject, contents)
yag.close()
print("发送成功")