pip3 install exchangelib
#Author Kang
from exchangelib import DELEGATE, Account, Credentials, Message, Mailbox, HTMLBody
def Email(to, subject, body):
creds = Credentials(
username='zhoumingkang',
password='帐号验证的密码'
)
account = Account(
primary_smtp_address='zhoumingkang@cedarhd.com',
credentials=creds,
autodiscover=True,
access_type=DELEGATE
)
m = Message(
account=account,
subject=subject,
body=HTMLBody(body),
to_recipients = [Mailbox(email_address=to)]
)
m.send()
cpu = 80
mem = 70
message = '''-----------运维报告------------<br>
CPU使用率:%s<br>
可用内存:%s<br>
''' %(cpu,mem)
Email("zhoumingkang@cedarhd.com","主题",message)
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。