Skip to main content
License: AGPL-3

Mail Inline CSS

When you send HTML emails you can’t use style tags but instead you have to put inline style attributes on every element. So from this:

<html>
<style type="text/css">
h1 { border:1px solid black }
p { color:red;}
</style>
<h1 style="font-weight:bolder">Peter</h1>
<p>Hej</p>
</html>

You want this:

<html>
<h1 style="font-weight:bolder; border:1px solid black">Peter</h1>
<p style="color:red">Hej</p>
</html>

This module use premailer library to do this.

It parses an HTML page, looks up style blocks and parses the CSS. It then uses the lxml.html parser to modify the DOM tree of the page accordingly.

Installation

To install this module, you need first to install premailer python library with:

pip install premailer

Usage

Just use any mail template as Odoo standard feature

Try me on Runbot

Note:

Odoo with module web_editor already implements this feature on the client side (js). This module brings this server side feature for cases without js part. It could the more stable way over the Odoo versions with a stable api in a dedicated library with adhoc python unit tests.

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smash it by providing detailed and welcomed feedback.

Credits

Images

  • Odoo Community Association: Icon.

Contributors

Do not contact contributors directly about support or help with technical issues.

Funders

The development of this module has been financially supported by:

  • Akretion

Maintainer

Odoo Community Association

This module is maintained by the OCA.

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

To contribute to this module, please visit https://odoo-community.org.

Metadata

Release files for odoo10-addon-mail-inline-css 10.0.1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for odoo10-addon-mail-inline-css 10.0.1.0.1
File Interpreter ABI Platform
odoo10_addon_mail_inline_css-10.0.1.0.1-py2-none-any.whl Python 2 none any Details

Release files / odoo10_addon_mail_inline_css-10.0.1.0.1-py2-none-any.whl

Download URL odoo10_addon_mail_inline_css-10.0.1.0.1-py2-none-any.whl
Size 21.9 kB
Tags Python 2
SHA-256 checksum
How to use checksums
b4d893a700a41f39da2d222e447077428514cffea84212268a8c4e3a29cf0813
BLAKE2b-256 checksum
How to use checksums
a0a42aa0c555c4440490f627e9b6760bfa4642cc5d4f3dbac0240f7f76b0a906
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.5
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page