python代码如何利用阿里云发送邮件
此代码是磁盘使用率超过90%就会发送邮件 #!/usr/bin/env python #coding:utf-8 import socket import re import os import smtplib import datetime import commands,time from email.mime.text import MIMEText from email.utils import formataddr # 硬盘使用率报警阀值 m=socket.gethostname() s="磁盘使用率超过:" b="测试服务器" d="%" hd_usage_rate_threshold = 90 def check_hd_use(): cmd_get_hd_use = '/bin/df' try: fp = os.popen(cmd_get_hd_use) except: ErrorInfo = r'get_hd_use_error' print ErrorInfo return ErrorInfo ...