其他分享
首页 > 其他分享> > 邮件自动化——解放人工监控的双手,用于机器报错提醒

邮件自动化——解放人工监控的双手,用于机器报错提醒

作者:互联网

方案1

import yagmail
# 登录SMTP服务器
# user - 邮箱账号
# password - 邮箱登录授权码
# host - 邮箱SMTP服务器地址
yag = yagmail.SMTP(user = "user", password='password', host = 'smtp.yeah.net')

# 编辑邮件内容
contents = [
    'Hello, i am sent by yagmail!',
    'Here is a test mail!',
 #   yagmail.inline('E://avator.png'),#内嵌图片
  #  'E://avator.png'  #以附件形式发送
    ]

# 发送邮件
# to - 收信邮箱
# subject - 邮件主题
# contents - 邮件内容
yag.send(to = ['@163.com'], subject = 'SendHelloTest', contents = contents)

方案2

https://zhuanlan.zhihu.com/p/89868804

标签:password,SMTP,报错,邮件,自动化,邮箱,yagmail,contents
来源: https://blog.csdn.net/qq_42830971/article/details/112429255