New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mass mailing messages sent without proper <body> tag #10954
Comments
👍 If not, you can always write a module that encapsulates the output in this tag, isn't it? |
👍 |
1 similar comment
👍 |
@pedrobaeza You'd loose the WYSIWYG feature. |
Are you sure? I think they are both compatible. |
Let's suppose this is your email's body:
Odoo would send it as you see it, and the website-based email designer runs in a whole page, so what I guess it's doing is to extract the editable part from the page and send it. Now we need this body:
If I inject the surroundings at send time, you would see a normal To get a full-html WYSIWYG editor, It should be run inside an iframe, where the full HTML is found and correctly rendered, and Odoo should send all that iframe's contents in the email (not only what's inside the editable part). You design emails in an iframe from Odoo 9 onwards, which gives you a chance to do this, but in v8 you do it in a full page, and that makes it much harder to achieve AFAIK. But even in v9 (and master, I checked), you do not get the full HTML structure, which is why this bug affects all versions, although I doubt it can be fixed in v8. |
And why don't you inject it before showing it in the editor? |
Anyway it would get stripped when saving. |
This must be fixed in MASTER, if not customer need Mailchimp or similar as external tool with their Mass Mailing Designs. How Odoo Enterprise works is not enough. @nhomar do you have this problem with your customers? cc @lasley cc @Yenthe666 |
FTR, There are already projects that have [almost] full mail client compliance, such as mailgun/transactional-email-templates, nice for the pros, but impossible to integrate as long as Odoo emails have no proper |
Apologies in advance if this is off topic for this thread. I have noticed there also seems to be no way to add the preview/pre-header text into the mass mailing templates easily as an end user. What I mean by preview text can be found here: https://www.campaignmonitor.com/blog/email-marketing/2011/12/a-practical-guide-to-email-preheaders/ It is simply the first div after the opening |
Oops I missed this. We do experience this issue on our end as well & had to do some ghetto monkey patching to inject the proper tags. We are using Foundation templates if it matters. Our use case is exactly what @yajo pointed out in the first comment - client specific styling. AFAIK the second example for color styling goes against best practices of email design. All non-application specific styles should be inline in order to guarantee compliance with unwieldy web clients, like Gmail, which does not process within the |
Hello, Aren't the On an html field, you now have several level of sanitization class Html(_String):
type = 'html'
column_type = ('text', 'text')
_slots = {
'sanitize': True, # whether value must be sanitized
'sanitize_tags': True, # whether to sanitize tags (only a white list of attributes is accepted)
'sanitize_attributes': True, # whether to sanitize attributes (only a white list of attributes is accepted)
'sanitize_style': False, # whether to sanitize style attributes
'strip_style': False, # whether to strip style attributes (removed and therefore not sanitized)
'strip_classes': False, # whether to strip classes attributes
} The Styling email is a tricky thing and we don't tend to allow much as it usually won't work in many email clients anyway. Keep it simple. |
Mostly, html, body, head, & style tags tend to be removed in web clients, but not in desktop/mobile ones. To have responsive emails, mostly for smartphones, you need media queries, which are supported only on a few email clients. Honestly, making sensible emails that look good everywhere is a pain. I recommend you to read Mailgun's post about that. That's why we are considering using a well-proven framework in an additional addon, such as the one from Mailgun or the one @lasley said, the same way you use Bootstrap for website templates. But this limitation of not having html, head, body & style tags simply makes that impossible. So, if I'm not wrong, what you mean @mart-e by your comment is that we could define something like this...
... to make Odoo not remove the html, head, style & body tags? Also, I understand this would be for future v10, but any solution for v9? Thank you. |
No, that's not that. The html & body will always be removed, it's part of the global sanitisation of html content and the only way to prevent that is to override the field to put _style_whitelist = [
'font-size', 'font-family', 'background-color', 'color', 'text-align',
'padding', 'padding-top', 'padding-left', 'padding-bottom', 'padding-right',
'margin', 'margin-top', 'margin-left', 'margin-bottom', 'margin-right'
# box model
'border', 'border-color', 'border-radius', 'height', 'margin', 'padding', 'width', 'max-width', 'min-width',
# tables
'border-collapse', 'border-spacing', 'caption-side', 'empty-cells', 'table-layout'] If you want to have more style (e.g. blinking text), you need to change the attribute to Also we will definitely not change the behaviour in v9 |
So still no way of adding those 4 tags to the whitelist and let Odoo do the rest of the magic? A way to change the whitelist or blacklist of elements/attributes would be great. Or simply a boolean for this special case, something like |
If you want to customise this, you can always alter the content of sanitisation constants to add or remove tags & attributes but we do not wish to modify this in standard. I have reported the issue that we can't add media queries but it's not a priority at the moment |
Hmm yes, I already saw that. The problem is that currently you cannot safely modify that. I mean that those are constants in a Do you have a solution for that? I might be missing something... |
It looks like Gmail has recently added support for media queries: https://developers.google.com/gmail/design/css There are some workarounds though: |
@yajo Did you achieve any progress on this? Could it be possible to put the sanitisation constants in a xml data file, which then could be adapted per database? |
No progress so far, sorry |
Hi @mart-e @fpodoo we notify this 1 year and 7 months ago. Is this going yo be fixed in v11? This is not a problem of customer expectation this is a problem of customer experience. Already, again, OCA giving a workarround solution in OCA/social#192 Why a Odoo customer cannot use?:
If we sell you can change mailchimp or similar with Odoo you have to add this. Please take care on this Thanks |
One funny thing is that Odoo decided it is better to have a script that converts all your css styles into inline styles instead of putting all css styles into inline Besides the maintainability problem of such approach, there's also the problem of inline styles being incompatible with media queries, so until this bug is fixed, Odoo is doomed to send no responsive mails, which in turns forces Odoo to fall behind other mass mailing systems and answers your question @rafaelbn. |
Let's try again after Odoo Experience... 😄 Please @odony could you solve this for next year please? 🙏 |
Oh man, too bad that didn't make it.. 😢 |
Any idea how much effort would be required to just make this a module? I don't think we should hold our breath on this, and I kind of want it in v10 |
The problem is that this stripping does not happen in an addon, but in a tool. Possibly here or around it: Lines 28 to 29 in cd48a80
So I imagine fixing this in an addon without monkey patching would be quite hard. Besides, once fixed, you'd need to create an addon that uses a mail template framework (see #10954 (comment)) to actually make the addon useful, and make sure there are no conflicts with current behavior (see #10954 (comment)). |
A "light patch" could be to make those tags params overridable via server cfg (and w/ server_environment then). This could be a 1st step w/out hacking too much the existing machinery. The 2nd step could be: propose to move those tools calls to an abstract model to ease override. I'm not sure we have an |
Hmm yeah, neat idea. The 1st option should be just enough I think (in case @odoo still wants to have no responsive emails, at least the community shouldn't be locked just for that reason). |
Well, I have to insist because mathematical logic. Odoo have presented this year in How to Achieve Higher Revenue and Faster Growth with Marketing Automation Campaigns its
What do you think about this issue Geoffrey? You are an expert. In my logic if Odoo has developed a new Super-Tool for marketing automation it means that in v12 the will want to be able to send pretty responsive emails ! Isn't it @fpodoo ? ☕️ Thanks! |
Hello, dear all! Please any plan for this? Any news? Really @mart-e this is a great headache for customers and for us giving them support. This is a must have in a Mass Mailing tools. All customers will really appreciate if you could introduce this in v12. And furthermore you can after this say that Odoo could replace Mailchimp (now not, you should say this...) Thanks in advance for any news @Yenthe666 do you know who is responsible of v12 improvements in mass mailings? (Thanks!) Regards |
Hi @rafaelbn, I'm not sure who is responsible for mass mailing at the moment, @mart-e should be able to answer that for you though. Regards, |
Hi all, This problem has been reported 2 years ago! Is still not attended? 😞 v8, v9, v10, v11, really Odoo is not going to attend this ?
Please @mart-e could any one investigate with @yajo 's or @chienandalu support to solve this in v12? (2 years waiting for this basic functionality) Check a Mailchimp email code with a Code example
|
@rafaelbn please don't flood this issue and paste a large content that way. Enclose it between |
The In any case, that code above proves that basically making a 1st class email with Odoo is impossible until this issue is fixed. Thanks @rafaelbn! |
@tde-banana-odoo maybe you can read this explanation about the importance of this and check if it can be done for v12. |
It seems to be handled in #24572 |
I found a quick way to wrap the html of html body in a markup layout which contain I use version 9.0 and I extended in my module the
"header_newsletter" is a custom class added in a custom snippet which is inserted in the mass mailing editor with others available snippets that built the template. |
@yajo I think this is now possible to do it on v12, right? |
In v12 you have a mass mailing layout that is used (mass_mail_layout = self.env.ref('mass_mailing.mass_mailing_mail_layout', raise_if_not_found=False)). It adds header, media, ... |
Then this means that we can close this issue, right? |
The code: https://github.com/odoo/odoo/blob/12.0/addons/mass_mailing/views/mass_mailing_layout.xml So yes, it seems we can close now. Thanks! |
While writing module OCA/social#44 we found a bug in Odoo.
If you want to write responsive email snippets, you need to add media queries, and for that you need to write
<style>
tags, that need to be inside the<head>
tag.Right now, Odoo does not send any
<html>
,<head>
or<body>
tags, so there is no way to write that.Also you maybe need to write special code for Outlook's ugly HTML renderer, for what you need things like:
Which are quite hard to inject because either Odoo strips the comment or CKEditor does. But this would not be so important if we had a
<head>
where to insert mail templates as said above.@rafaelbn @dgzurita
The text was updated successfully, but these errors were encountered: