# -*- coding: UTF-8 -*- import yagmail yag = yagmail.SMTP( user='xclouds@qq.com', host='smtp.qq.com', password='899', port='25', smtp_ssl=False) yag.send( to='470234147@qq.com', subject='from xdc', contents='didi!') # 邮件正文 # attachments= ['/root/1.jpg'] # 添加附件