I'd like to create a
text/plain message using Markdown formatting and transform that into a
multipart/alternative message where the
text/html part has been generated from the Markdown.
I've tried using the filter command to filter this through a python program that creates the message, but it seems that the message doesn't get sent through properly. The code is below (this is just test code to see if I can make
multipart/alternative messages at all.
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 message body sent to the filter command when you compose (the headers are not included). Once I get this working, I think the markdown part won't be too hard.