Skip to content Skip to sidebar Skip to footer

Does Python Have A Module To Convert CSS Styles To Inline Styles For Emails?

I know this exists in other languages, but I want it for Python to I can send emails that'll show up in GMail, etc.

Solution 1:

I had to do the same thing a while back and put the module I made for it up on GitHub https://github.com/rennat/pynliner


Solution 2:

There are now many choices for this. Here are two more in what seems to be decreasing order of activity:


Solution 3:

toronado is Fast lxml-based CSS stylesheet inliner.

Installation : pip install toronado

Example :

import toronado
document = """<html>
<head>
   <style type="text/css">
      h1 { color: red; }
   </style>
</head>
<body><h1>Hello, world.</h1></body>
</html>"""
print(toronado.from_string(document))

Solution 4:


Post a Comment for "Does Python Have A Module To Convert CSS Styles To Inline Styles For Emails?"