我有下面的Python代码,用于从文件filename
的内容向我的ID发送电子邮件。我正在尝试发送带有文本颜色格式的电子邮件。在
有什么意见请指教。在
def ps_Mail():
filename = "/tmp/ps_msg"
f = file(filename)
if os.path.exists(filename) and os.path.getsize(filename) > 0:
mailp = Popen(["/usr/sbin/sendmail", "-t", "-oi"], stdin=PIPE)
msg = MIMEMultipart('alternative')
msg['To'] = "karn@abc.com"
msg['Subject'] = "Uhh!! Unsafe rm process Seen"
msg['From'] = "psCheck@abc.com"
msg1 = MIMEText(f.read(), 'text')
msg.attach(msg1)
mailp.communicate(msg.as_string())
ps_Mail()
这是我用来发送HTML电子邮件的片段。在
请同时阅读this
相关问题 更多 >
编程相关推荐