Email to HTML in Python [closed]
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this questionI am开发者_JS百科 looking for a library which can take a raw email message and convert it to appropriate HTML in Python.
Any help will be appreciated.
Use the MIME package included in email
http://docs.python.org/library/email Here some examples http://docs.python.org/library/email-examples.html
You have two choices,
If the email has a HTML payload, you can use that - maybe put a simple template together to wrap whatever metadata fields (from, to, subject, date etc.) you need.
If there is no html body, you can just wrap it in a <pre></pre>
- use the same template.
Sorry, I can't name a library - there is not a lot to do.
What you can do is identify an open source app that handles email in a way you like it and take a look at the code. like this ppwm at sourceforge
Here's some Python code to convert text to HTML
精彩评论