html_mail
The editor behind Odoo's email bodies. html_mail is the html field retuned for mail clients: styles inlined on save, layouts email clients cannot render stripped out.
| Technical name | html_mail |
|---|---|
| Field types | html |
| Views | form |
| Module | mail, installed in practically every Odoo database |
| Used in core | 12 occurrences across 9 modules, including mail, hr_recruitment, mail_group, survey, website_slides, product_email_template |
| Versions | Odoo 20.0, Odoo 19.0, Odoo 18.0 |
| No-code setup | No. Studio's Html field widgets do not include the mail variant; it is applied in XML. |
| Alternatives | html, text |
What the Email HTML field does
What this means for your team
Supported options in Odoo 19
| Option | Type | What it does |
|---|---|---|
height | number | Fixed editor height in pixels, with overflow scrolling enabled. Inherited from the html field. |
allowImage | boolean | Switches image insertion in the editor. Inherited; note html_mail additionally never converts dropped images into attachments.(default: true) |
allowVideo | boolean | Switches video embedding. Inherited from the html field; video support in mail clients is its own adventure.(default: true) |
allowMediaDocuments | boolean | Switches document insertion from the media dialog. Inherited.(default: true) |
allowFile | boolean | Switches file insertion. Inherited from the html field.(default: true) |
allowChecklist | boolean | Switches checklist blocks in the editor. Inherited.(default: true) |
allowAttachmentCreation | boolean | Convenience switch that sets both allowImage and allowFile at once, read after them in extractProps so it wins when both are present. Inherited. |
dynamic_placeholder | boolean | Enables the dynamic placeholder picker for template style fields. Inherited; the Odoo 20 branch adds permission filtering on top.(default: false) |
dynamic_placeholder_model_reference_field | field name | Field on the record whose value defines the model placeholders are picked from, the mail template pattern. Inherited. |
embedded_components | boolean | Base html field switch for interactive embedded blocks. Forced to false by html_mail's extractProps regardless of the view's value.(default: true) |
codeview | boolean | Adds the raw code view toggle, honored only when developer mode is active because the extract multiplies it by odoo.debug. Inherited.(default: false) |
migrateHTML | boolean | Lets the editor run its markup migration pass on stored content when loading; disable to hand the editor stored HTML untouched. Inherited.(default: true) |
collaborative | boolean | Enables collaborative editing on the field, with collaborative_trigger passed alongside to the collaboration setup. Inherited from the html field. |
sandboxedPreview | boolean | Requests the editor's sandboxed preview handling for the content. Inherited; declared in the base extractProps.(default: false) |
cssReadonly | string | Asset bundle id used when rendering the field read only. Inherited from the html field. |
embedded_components is ignored here. The base html field defaults it to true, but html_mail's own extractProps overrides the result to false unconditionally, so interactive embedded blocks never reach an email body regardless of what the view requests. Set expectations accordingly when copying options from an html field recipe.
Working examples
Four changes that make HTML safe for inboxes
Version compatibility
| Version | Status | Notes |
|---|---|---|
| Odoo 20.0 | In development | Not released. Placeholder permission system, timezone aware datetime placeholders and no_move_node_plugin on the development branch. Details below. |
| Odoo 19.0 | Verified | Verified against the shipped source of the mail wrapper and the html_editor base. |
| Odoo 18.0 | Verified | Mail wrapper effectively identical to 19.0; underlying editor differences belong to the html field. |
Upgrade note for 18 to 19. The mail wrapper itself is effectively unchanged, the diff is two trivial lines, so template bodies and view options carry over. What actually evolves between versions is the underlying html editor; treat editor behavior differences as html field topics rather than html_mail regressions.
What is changing in Odoo 20
Common problems and fixes
| Symptom | Cause and fix |
|---|---|
| Email looks right in Odoo, wrong in Outlook or Gmail | Content pasted from design tools relies on classes and structures that do not fully survive inlining, or on CSS mail clients refuse. Author in the editor itself and test with a real send; keep layouts single column. |
| No column or grid layout option in the toolbar | The column plugin is deliberately removed from this widget. Expected. Emails needing columns require a hand built, table based template from a developer. |
| Embedded blocks from an html field recipe do not appear | html_mail forces embedded components off regardless of options. Expected. Those blocks are not email safe. |
| Dropping an image does not create an attachment like elsewhere | dropImageAsAttachment is disabled in this widget's editor config. Expected. Host campaign images properly and insert by URL for reliable rendering. |
| codeview option set but no code view appears | The base field only honors codeview when developer mode is active. Enable developer mode, or accept that end users do not get raw HTML editing. |
| Placeholder picker missing fields after a future Odoo 20 upgrade | The development branch restricts non template editors to whitelisted expressions and drops o2m, m2m, boolean and non searchable fields. Grant the mail template editor group to power users, and re-test templates during the upgrade. |
Email HTML field vs the alternatives
| Widget | Best for | Key difference |
|---|---|---|
html_mail | Email bodies and mail templates | Inlines CSS on save and strips email hostile features |
html | Rich content that lives inside Odoo | Full editor with embedded components, no inlining pass |
| text | Plain text that must stay plain | No formatting, no editor, nothing to break in a mail client |
Frequently asked questions
What is the html_mail widget for?+
Why does Odoo inline CSS into email HTML?+
Why can I not add columns to my email body?+
Which options does html_mail accept?+
How do dynamic placeholders work with this widget?+
Why did my dropped image not become an attachment?+
Is html_mail available through Odoo Studio?+
What changes for html_mail in Odoo 20?+
Emails that sell in Odoo and die in Outlook?
Template HTML, placeholder logic and deliverability live at the intersection of Odoo and thirty mail clients. We build and rescue Odoo email templates, quotation mails, portal notifications and campaign flows, tested against the inboxes your customers actually read.
Book a free consultation