python模块整理17-mail-smtplib
#!/usr/bin/env python
import subprocess
import smtplib
import string
p=subprocess.Popen("df -h",shell=True,stdout=subprocess.PIPE)
MSG=p.stdout.read()
FROM="root@localhost"
TO="root@localhost"
SUBJECT="DISK Usage Report"
msg=string.join(("From:%s" % FROM,"TO:%s" % TO,"Subject:%s" % SUBJECT,"",MSG),"\r\n")
#print msg
s=smtplib.SMTP("localhost")
s.set_debuglevel(1)
s.sendmail(FROM,TO,msg)
s.quit()