我想text/plain
使用 Markdown 格式创建一条消息,并将其转换为从 Markdown 生成部分的multipart/alternative
消息。text/html
我尝试使用 filter 命令通过创建消息的 python 程序对其进行过滤,但似乎消息没有正确发送。代码如下(这只是测试代码,看看我是否可以multipart/alternative
发送消息。
import sys
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
html = """<html>
<body>
This is <i>HTML</i>
</body>
</html>
"""
msgbody = sys.stdin.read()
newmsg = MIMEMultipart("alternative")
plain = MIMEText(msgbody, "plain")
plain["Content-Disposition"] = "inline"
html = MIMEText(html, "html")
html["Content-Disposition"] = "inline"
newmsg.attach(plain)
newmsg.attach(html)
print newmsg.as_string()
不幸的是,在 mutt 中,您只能在撰写时将消息正文发送到过滤器命令(不包括标题)。一旦我得到这个工作,我认为降价部分不会太难。