I would like to create a message text/plainusing Markdown formatting and convert it to a message multipart/alternativewhere the part text/htmlwas generated from Markdown. I tried using the filter command to filter this through a python program that creates a message, but it seems that the message is not being sent properly. The code below (this is just a test code to see if I can post at all 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()
Unfortunately, in mutt, you only get the body of the message sent to the filter command when linking (headers not included). As soon as I get this job, I think the markdown will not be too complicated.
source
share