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
Inject contents of <head>
tags into composer's head section. Also overwrite DOCTYPE
and all <body>
attributes
#79
Comments
Thanks - I have made the issue title more specific trying to describe what you want to achieve, At the moment the
|
In deed, the contents of is included in body tag but that way, some css rules no longer works as it is suposed when the mail is opened in a browser rather than in TB. For example properties of the tag (class:hover effect) will no longer works how it is suposed because it must be inside head tag and not body tag. You only notice that if you open the mail directly from email web server account with a browser (like edge/firefox/chrome/opera/etc.). If you open in TB a:hover effect (somehow??) continues working as espected (sort of rall back/reinjection thing?? i dont know). This problem/issue (behaviors rules related) extends to overs tag properties when inserted in body rather than head tag. Sorry for my very bad english... Hope you understand what i mean/explain.... |
If you are talking web mail interface: they routinely destroy a lot of the CSS rules so that it "fits" with their interface. You have to give a specific example (a html template / file) if you want me to test something!
It's because Thunderbird internally is just the Firefox browser, and that is very standards compliant. If you open the same email on Firefox but let's say on gmail.com, all bets are off, as they remove a lot of rules! You cannot expect web mail interfaces to be standard compliant as they won't easily then fit their advertisements.
This is at least doubtful. It is possible that some web interfaces remove css only selectively, but I do not see the big difference between a rule in
It's not the servers that remove this information, it's "mail portals". The email will still be intact on any standards compliant mail client. People who use "mail portals" such as gmail.com do not really care much about the layout of their emails.
If it is not present in Thunderbird, chances are it is not standards compliant. Or there is a rule that has higher specificity. Instead of second guessing you can use the built in tool "inspector" to see which rule overwrites which other rule. You can find it in the tools menu under
I need to test this
The best DOCTYPE is HTML. Which is HTML5 and the most standards compliant. If you still use transitional then all bets are off; I highly recommend not using these broken doc types as they are highly unpredictable due to many browser bugs.
the only main limitation in HTML in mails is that you cannot use script. Everything else is allowed - including flex model, float, animations etc. It's all allowed. But you cannot expect that every mail client will actually display it - many mail clients thing it's nicer to display mails as bare minimum so they modify the mail body. There is not much you can do about this as mail composer except guessing and testing and then coming up with something that "mostly works".
That's why it is important to write your email templates in an external text only editor (such as notepad++) with Syntax-highlighting and preview it in a browser. (Pretty much any browser will do). Never use a WYSIWYG editor (such as frontpage or even the built in COmposert of Thunderbird - they create terrible, easily breaking markup). use text only and test. |
Thanks for your detailed info. I was quite understandable. I send you a file with a:hover tag. |
I forgot to mention: The old stationery addon (no longer supported but i still use it because iam in use of TB59) has the ability to parse the template loaded from file preserving the content of head tag. |
I am aware of this. the author stopped last year so i had to integrate the functionality from version Tb68. i didn't want to copy all his code my own addon was already very complicated. i managed to integrate the external template feature into the settings dialog (making a separate tabbed option for configuring like stationery would have felt disjointed and hard to discover by existing users). The SmartTemplate4 method was always dismantling the body part completely (only retaining the blockquote) and then rebuilding it with the contents of the stationery html file (or html fragment). i will look into whether we have access to the head section or we can somehow preserve it or move it "up above the body". hopefully Thunderbird will not forbid experiments the full access to its internal functions too soon and eventually implement an equally powerful public API so we can rewrite the many 1000 lines of parsing logic in a web / mail extension. hopefully we can sell enough licenses to fund this work. |
Thanks for your attention and explanation. |
I hope you can drop |
<head>
tag contents, including DOCTYPE and including <body>
attributes
So it turns out that some mail clients indeed ignore or drop Thunderbird 115 version: smartTemplate-fx-4.1pre2.zip Thunderbird 91-102: smartTemplate-fx-3.18pre13.zip This feature requires a SmartTemplates Pro license, and can be activated on the Advanced Settings page under the new group "Miscellaneus": To do: translate the setting into the other 20 languages To test the version above, download the zip file, drag the file into Thunderbird Add-ons Manager, do not extract contents or if won't install. You can rename it to quickfolders_6.0.xpi if it makes you feel better. It's the same thing, but github doesn't allow attaching that file format. |
<head>
tag contents, including DOCTYPE and including <body>
attributes<head>
tags into composer's head section. Also copy DOCTYPE and all <body>
attributes
<head>
tags into composer's head section. Also copy DOCTYPE and all <body>
attributes<head>
tags into composer's head section. Also overwrite DOCTYPE
and all <body>
attributes
I am not sure if I am able to overwrite Personally I don't use the |
I personally would prefer not change the DOCTYPE for compatibility reasons. Body tag: Sure, in a perfect world you do never format the body tag of an e-mail, but unfortunately some mailers have no manners. Here you need to overwrite indeed their styles with |
I have implemented the body attribute merging as well. There is one minor caveat - basically the Existing attributes of the body tag may be overwritten. You can include multiple body attributes, the last attribute parsed overwrites previous ones. I think any additional class attributes of the template I include a test file with injected style sheet below: Tb 91-102: Tb 115: The usual - to test the preview versions above, download the zip file, drag the file into Thunderbird Add-ons Manager, do not extract contents or if won't install. |
For the topic of automatic CSS inlining, see my question at this repository. Apparently the juice library may be a possible solution for this topic. |
Finally implemented in 4.1 - Published 09/08/2023 |
Involved are DOCTYPE, html, head and body Tags. If I delete the standard TB HTML Code and copy my own HTML Code in an new E-Mail in Thunderbird everything works perfekt. If I use ST4 im getting a really mess. Code Sample enclosed. Hope, this get solved :)
ST4.Code.Sample.txt
The text was updated successfully, but these errors were encountered: