使用Yagmail 发送邮件
使用Yagmail 的时候有要注意:如果接收者有多个或者是附件有多个时对应的变量要使用数组来传值
`import yagmail
class SendEamils(object):
"""发送邮件"""
@staticmethod
def send_report(subjects, cons, files):
# 初始化服务器等信息
smtp_server = "sit_test@xx.com"
from_user = "sit_test@xx.com"
from_pass_word ="123456"
to_user = ["qq@xx.com","qq1@xx.com"]
# 连接邮箱Server
yag = yagmail.SMTP(user=from_user, password=from_pass_word, host=smtp_server)
# 发送邮件
yag.send(to_user, subject=subjects, contents=cons, attachments=files)
yag.close()
`
浙公网安备 33010602011771号