使用yagmail发邮件
直接上代码吧
import yagmail yag = yagmail.SMTP(user="xxxx@163.com",password="Jxxxxx",host="smtp.163.com") # password 这里不是登录密码,是授权码 to = "lifq@hahah.com" subject="测试" contents=["测试内容"] yag.send(to=to,subject=subject,contents=contents)
直接上代码吧
import yagmail yag = yagmail.SMTP(user="xxxx@163.com",password="Jxxxxx",host="smtp.163.com") # password 这里不是登录密码,是授权码 to = "lifq@hahah.com" subject="测试" contents=["测试内容"] yag.send(to=to,subject=subject,contents=contents)