import yamail
password="amyli1499"
host="smtp.163.com" #smtp.qq.com
user="meiyanshandong@163.com"
to = ["zhangmeiyan01@renmaitech.com"]
cc = ["549541889@qq.com"]
def send_mail(subject,content,files=None):
smtp = yamail.SMTP(host=host,
user=user,
password=password,
)
smtp.send(to=to, cc=cc, subject=subject, contents=content, attachments=files)
if __name__ == "__main__":
file= ‘../Mia.jpg‘
send_mail("sub test","新年好",file)
原文:https://www.cnblogs.com/zhangmeiyan/p/14376968.html