No Code Attached Yet bug
avatar Pinkeltje
Pinkeltje
5 Jan 2025

Steps to reproduce the issue

Fresh install of Joomla 5.2.2.
Go to mailtemplates and open Contacts: Contact Form Mail
Do nothing and just save

Expected result

Mail sent to admin contains contactform information

Actual result

Mail sent to admin only contains language constant COM_CONTACT_ENQUIRY_TEXT

System information (as much as possible)

Joomla 5.2.2
PHP 8.2.12

Additional comments

Database entries for Global Configuration: Test Mail which stays ok upon save and entry for Contacts: Contact Form Mail where hmtlbody is wrong
Image

avatar Pinkeltje Pinkeltje - open - 5 Jan 2025
avatar joomla-cms-bot joomla-cms-bot - change - 5 Jan 2025
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 5 Jan 2025
avatar Fedik Fedik - change - 5 Jan 2025
Labels Added: bug
avatar Fedik Fedik - labeled - 5 Jan 2025
avatar Fedik
Fedik - comment - 5 Jan 2025

That happen because TinyMCE forces every content to be inside a tag, and so it wrap the default text in to <p> when you opened it first time.

As work around:
Change editor to Codemirror (in global configuration), and edit that email template again, where remove <p> tag

avatar Pinkeltje
Pinkeltje - comment - 5 Jan 2025

First of all I'm using JCE editor, second I know how to solve it by creating my own hmtl body that works without problems.
I just reported this as a bug, because inexperienced users might open the email template and then save it and having this problem. So I think there should be made a fix.

avatar Fedik
Fedik - comment - 5 Jan 2025

My comment is correct and adressed to everyone who will ever will hit this issue in the future. There is no easy fix for it.
I do not see why you complaining.

jce is based on tinymce.

avatar brianteeman
brianteeman - comment - 5 Jan 2025

This is a bug which needs to be fixed

avatar Pinkeltje
Pinkeltje - comment - 5 Jan 2025

@brianteeman totally agree. I have enough knowledge to eiter remove entries from database or create my own html template, but this is not how it is supposed to work.
Same as this issue which has been reported multiple times. #44396

avatar fgsw
fgsw - comment - 5 Jan 2025

Same as this issue which has been reported multiple times. #44396

Issue is labeled as bug.

avatar Fedik
Fedik - comment - 5 Jan 2025

This is the TinyMCE issue, the same as #44396, it is how TinyMCE works.

We probably could force Codemirror for HTML editing for emails, similar as it done for template files editing.
Or have an option to change the editor for Email template, that could be a good solution.

avatar Pinkeltje
Pinkeltje - comment - 5 Jan 2025

@Fedik
With all due respect, this is of course complete nonsense. As you can see, and could have seen for yourself if you had bothered to test things, you could have seen that using JCE and customising html for mail to test email settings does work.
Furthermore, codemirror is anything but user-friendly and not suitable for inexperienced users.

avatar LadySolveig
LadySolveig - comment - 7 Jan 2025

There seems to be a lot of frustration here from your point of view @Pinkeltje. But with all due respect, this tone and the insinuations are completely unnecessary and missplaced. Many thanks, @Fedik, for your explanations and constructive suggestions on this issue. I think this will be very helpful for other people who unfortunately have to deal with the tooling themselves.

avatar LadySolveig
LadySolveig - comment - 7 Jan 2025

Back to the actual problem, as already mentioned, there is a conflict between the behaviour of the WYSIWYG editors, whether TinyMCE or JCE, and the creation of the templates when they are first saved.
I think the suggestion to force an editor such as CodeMirror is absolutely appropriate in this situation.

To be honest, I think this is absolutely sufficient, as an inexperienced user will probably end up very frustrated with the mail templates if he tries to style anything here, even with a WYSIWYG editor.

These editors are simply not designed for this and emails do not work 1:1 like an HTML page. In fact, an inexperienced user should not enter anything more than plain text here or use one of the countless free generators especially for emails in the www and then copy and paste directly here. This also ensures to some extent that the emails reach the recipients on all clients (Outlook, GMail, Thunderbird, etc.) and possibly in dark and light mode as the creator intended.

I think it's an even more frustrating experience for inexperienced users when they ‘build’ something here in painstaking work only to realise that it looks completely different on the recipients end.

avatar Pinkeltje
Pinkeltje - comment - 7 Jan 2025

OK. I'll stop reporting bugs, though. I am apparently not taken seriously and assumptions are being made here without bothering to test.

avatar brianteeman
brianteeman - comment - 7 Jan 2025

@Pinkeltje please dont stop reporting bugs. What you identified is a bug and it not correct to say that it can only be fixed by changing to use codemirror.

@LadySolveig it is NOT about styling the message to look like a web page but some simple markup such as even a bold tag

avatar brianteeman
brianteeman - comment - 7 Jan 2025

@Fedik

That happen because TinyMCE forces every content to be inside a tag, and so it wrap the default text in to

when you opened it first time.

It doesnt have to do that - thats a configuration option

avatar Fedik
Fedik - comment - 8 Jan 2025

thats a configuration option

@brianteeman I would like to see that :)

avatar LadySolveig
LadySolveig - comment - 8 Jan 2025

OK. I'll stop reporting bugs, though. I am apparently not taken seriously and assumptions are being made here without bothering to test.

Too bad reporting bugs is one of the biggest gifts for this project to stay alive. I really appreciate your commitment @Pinkeltje !
Nevertheless, respectful behaviour is at least as important to move forward.

@brianteeman There are always several solutions to a problem. Fedir has so far been the only one to make a constructive suggestion. If, as you say, it is possible to configure this differently for TinyMCE in particular for the mail templates, then perhaps we could implement this in the CMS. However, this would probably not solve the issue for the creator? As he has pointed out that he installs and want to use JCE.

avatar brianteeman
brianteeman - comment - 8 Jan 2025

The problem is that the language constant should NOT be displayed in the html editor - it should be the language value. If you enable language debug then you will see that the language string is not found because it is looking for the langauge string in the ADMIN language file but the language string is only present in the SITE language file

I am not sure if the best solution is to add the string to the admin language file OR if the com_mails component should be updated to look in both the site and the admin files.

If you look at the function

public static function loadTranslationFiles($extension, $language = 'en-GB')
you will see that it is only ever loading the admin language files!!

You do not see the reported problem in any of the mail templates because they are all admin language strings as a super quick check would have shown

This is NOTHING to do with the editor being used and NOTHING to do with the editor wrapping strings in the html black element p

avatar brianteeman
brianteeman - comment - 8 Jan 2025

As further confirmation that this is nothing to do with the html editor the exact same problem for the exact same reason exists for the com_contact mail templates when using PLAINTEXT

avatar brianteeman
brianteeman - comment - 8 Jan 2025

The bug was caused by the changes made by @zero24 in #43475

avatar Fedik
Fedik - comment - 8 Jan 2025

Okay, then it is not an editor issue, thanks for checking.
I remember in past it was shown a language constant, untill user push some button. It seems I missed this change.

avatar brianteeman
brianteeman - comment - 8 Jan 2025

would have saved upset if both you and @LadySolveig had actually looked at it before replying - but moving forward I am not sure on the best way forward.

  1. moving/copying the language strings to the admin language file (I can do that) but then it would only be for this component and others using the mail template system would face the same bug
  2. modify the function loadTranslationFiles to check the site language files - this would be the best approach but that change is above my skillset - perhaps @zero-24 can modify his code and submit a PR
avatar brianteeman
brianteeman - comment - 8 Jan 2025

@Pinkeltje as a quick fix for yourself you can add these two lines to administrator\language\en-GB\com_contact.ini

COM_CONTACT_ENQUIRY_SUBJECT="{SITENAME}: {SUBJECT}"
COM_CONTACT_ENQUIRY_TEXT="This is an enquiry email via {URL} from:\n{NAME} <{EMAIL}>\n\n{BODY}\n\n{CUSTOMFIELDS}"

and then click on the reset buttons in the mail template
Image

avatar zero-24
zero-24 - comment - 8 Jan 2025

I can take a deeper look into this next week.

avatar Pinkeltje
Pinkeltje - comment - 8 Jan 2025

@brianteeman
Seems to be a missing language constant indeed. Added your constants to language overrides and now it works. But as said before, I just wanted to report the bug. We had this problem reported by a user on our Dutch Joomla forum. I already gave the solution to paste this in the code field of the html template, and that worked also:

<p>Dit is een aanvraag van: {NAME}</p>
<p>E-mail: {EMAIL}</p>
<p>Onderwerp: {SUBJECT}</p>
<p>Inhoud bericht: {BODY}</p>
<p>Via: {URL}</p>
<p>{CUSTOMFIELDS}</p>

@zero-24 Thanks for looking into it.
@Fedik and @LadySolveig
To show that it has nothing to do with the editor. This works like a charm:
Image

I think this should be an easy fix contrary to the fix for #44396

avatar zero-24 zero-24 - change - 13 Jan 2025
Status New Closed
Closed_Date 0000-00-00 00:00:00 2025-01-13 22:38:06
Closed_By zero-24
avatar zero-24 zero-24 - close - 13 Jan 2025
avatar zero-24
zero-24 - comment - 13 Jan 2025

Hi, please take a look into this PR: #44730
As there is a PR i will close this issue here. Thanks.

I think this should be an easy fix contrary to the fix for #44396

Yes thats more complicated. Could be solved by letting the strings beeing edited with an editor but I'm sorry will not have the time to dig deeper into that Issue.

Add a Comment

Login with GitHub to post a comment