Feature RTC Language Change PR-5.2-dev Pending

User tests: Successful: Unsuccessful:

avatar LadySolveig
LadySolveig
23 Jul 2024

Pull Request for Issue #39492 .

Summary of Changes

--The functionality for displaying the logo and sending it as an inline attachment depends on this fix #43828-- merged
--Depends on #43842 -- merged

Add support for mail template layouts as a parent wrapper around the existing mail templates.

  • ✅ A new default responsive mail template layout file mailtemplate.php for rendering mail content with sitename in footer and optional logo.
  • ✅ A new form field MailtemplateLayoutField to list available mail template layouts (overrides) from (frontend) templates.
  • ✅ Updates to MailTemplate class to handle layout data and render email content using the specified layout.
  • ✅ Configuration options in config.xml to enable/disable HTML layout and select a mail template layout globally.
  • ✅ Form updates in template.xml to include options for disabling HTML layout and selecting a mail template layout individual for each template.
  • ✅ Adjustments in TemplateModel to remove HTML layout fields when the mail style is set to plaintext.

Testing Instructions

Global Configuration -> Mail Templates

Set Mail Format--> HTML

Setup global Mail Templates configration for Mail Template Layouts as follows:

grafik

Scenario 1

Per Template Settings are disabled in the Global Configuration:

grafik

Go to System--> Mail Templates--> open Global Configuration: Test Mail
No additonal options in template edit view and the global settings are used.

grafik

Go to System --> Global Configuration--> Tab: Server

Scroll to the bottom and send out test mail

grafik

Your Test Mail should look similar like this

grafik

Scenario 2

Per Template Settings are enabled in the Global Configuration:

  • additonal options in template edit view with default settings to use the global options

grafik

grafik

Send the test mail again - the mail should look the same as in the previous step.

Scenario 3

Go to System--> Mail Templates--> open Global Configuration: Test Mail

grafik

Your Test Mail should look similar like this

grafik

Scenario 4

Go to System--> Site Templates--> open your Template --> Tab: Create Overrides and add override jooml->mail

Open file html --> joomla --> mail --> mailtemplate.php

and add this text

grafik

This is a test for template overrides

Go to System--> Mail Templates--> open Global Configuration: Test Mail

Set Logo File --> enables

Choose your layout override

grafik

Your Test Mail should look similar like this

grafik

Scenario 5

Go to System--> Mail Templates--> open Global Configuration: Test Mail

Choose Layout --> Use Global

Go to System--> Global Configuration--> Mail Templates

Choose your layout override

Your Test Mail should look like in the step before

Scenario 6

Go to System--> Global Configuration--> Mail Templates

grafik

Your Test Mail should look similar like this

grafik

Scenario 7

Go to System--> Global Configuration--> Mail Templates

Choose your layout override

grafik

Go to System--> Site Templates--> open your Template

Open file html --> joomla --> mail --> mailtemplate.php

and add this text

grafik

{METHOD}

Your Test Mail should look similar like this

grafik

Actual result BEFORE applying this Pull Request

grafik

Expected result AFTER applying this Pull Request

grafik

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

67ca7f9 23 Jul 2024 avatar LadySolveig cs
avatar LadySolveig LadySolveig - open - 23 Jul 2024
avatar LadySolveig LadySolveig - change - 23 Jul 2024
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 23 Jul 2024
Category Administration Language & Strings Layout Libraries
avatar LadySolveig LadySolveig - change - 23 Jul 2024
Labels Added: Feature Language Change PR-5.2-dev
65284e5 23 Jul 2024 avatar LadySolveig cs
avatar brianteeman
brianteeman - comment - 23 Jul 2024

Can I suggest changing this
image

to
image

avatar LadySolveig
LadySolveig - comment - 23 Jul 2024

@brianteeman if you want to change it by review in the language files I can commit directly :)

avatar brianteeman
brianteeman - comment - 23 Jul 2024

I am really happy to see this. It's the missing link to truly make branded html mails.

Basic functionality all works great.

avatar brianteeman
brianteeman - comment - 23 Jul 2024

When per template email setting is set to NO then I would not expect to see the layout options per email - is that an error/bug

When per template email setting is set to YES I have the option to enable the layout and select a layout but I cannot select an image - is that an error/bug or by design. I am hoping its an error/bug as I would use log as an image header

avatar Fedik
Fedik - comment - 23 Jul 2024

Thanks @LadySolveig . That it is very good feature.

Some thoughts for future.
What also would be cool, is to have an API to add inline images more freely, before layout rendering (or within the layout).
Kind of:

$mailTemplate->embedImages([
  'header-image' => 'path/to/image.jpg', 
  'logo-image' => 'path/to/logo.jpg'
]);
// Then in layout:
<img src="cid:header-image" alt="inline image"/>
<img src="cid:logo-image" alt="logo image"/>

But I not sure how to correctly interconnect it.

Do not code it here, just ideas for future. ?

avatar coolcat-creations
coolcat-creations - comment - 23 Jul 2024

Awesome, can one create a signature somewhere and embed it in the mail template?
Thank you!!!

avatar brianteeman
brianteeman - comment - 23 Jul 2024

Awesome, can one create a signature somewhere and embed it in the mail template? Thank you!!!

You would need to create your own mail template for that

avatar coolcat-creations
coolcat-creations - comment - 23 Jul 2024

Maybe this: ® Joomla mail 2024
www.localhost/mail/ is a language string and could be used?
I will check it out as soon as possible.

avatar brianteeman
brianteeman - comment - 23 Jul 2024

To answer comments about the html and inline styles used. @LadySolveig is absolutely correct html in email is stuck back in the 90's. I ran the generated email through a checker (mailtrap.io)

image

avatar LadySolveig
LadySolveig - comment - 23 Jul 2024

Thank you for the additional check @brianteeman
I will address your other comment later this evening and give an update ??

avatar brianteeman
brianteeman - comment - 23 Jul 2024

Maybe this: ® Joomla mail 2024 www.localhost/mail/ is a language string and could be used? I will check it out as soon as possible.

it is not a string. As already stated you would need to create a layout

avatar LadySolveig
LadySolveig - comment - 23 Jul 2024

@coolcat-creations you can create a complete layout override in your frontend template for this purpose ??

avatar coolcat-creations
coolcat-creations - comment - 23 Jul 2024

love it!

avatar webnet-assmann webnet-assmann - test_item - 24 Jul 2024 - Tested successfully
avatar webnet-assmann
webnet-assmann - comment - 24 Jul 2024

I have tested this item ✅ successfully on abe2893


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43829.

avatar sayfrndship1234
sayfrndship1234 - comment - 24 Jul 2024

great effort !

avatar LadySolveig
LadySolveig - comment - 25 Jul 2024

@brianteeman I am looking forward to your feedback :)

I have now reworked and hopefully incorporated the use case you described as practicably as possible.
(Short note: My changes are partly dependent on this PR #43842, so that only the fields that are relevant are displayed - whenever possible - and there is as little confusion as possible due to the additional options.

Scenario 1

Per Template Settings are disabled in the Global Configuration:

  • no additonal options in template edit view and the global settings are used.

grafik

grafik

Scenario 2

Per Template Settings are enabled in the Global Configuration:

  • additonal options in template edit view with default settings to use the global options
  • option to disable the sending of the logofile as an attachment. (If no logo is selected in the global configuration, it will not be sent anyway)
  • separated from the Mail Settings switcher:

As I noticed during testing that PHP Mail is always entered for the Mailer option when it Mail Settings is activated (completely independent of the settings in the global configuration).
I don't find it particularly user-friendly if I “only” want to change the layout and then have to check the mailer settings also per template. I consider this to be a major potential source of errors in this context.
But I am open to objections and other views here.

grafik

grafik

avatar LadySolveig LadySolveig - change - 25 Jul 2024
The description was changed
avatar LadySolveig LadySolveig - edited - 25 Jul 2024
avatar LadySolveig LadySolveig - change - 25 Jul 2024
Title
[5.2] [WIP] Feat: Introduce Mail Template Layout
[5.2] Feat: Introduce Mail Template Layout
avatar LadySolveig LadySolveig - edited - 25 Jul 2024
avatar LadySolveig LadySolveig - change - 25 Jul 2024
The description was changed
avatar LadySolveig LadySolveig - edited - 25 Jul 2024
avatar LadySolveig LadySolveig - change - 25 Jul 2024
The description was changed
avatar LadySolveig LadySolveig - edited - 25 Jul 2024
avatar LadySolveig LadySolveig - change - 25 Jul 2024
The description was changed
avatar LadySolveig LadySolveig - edited - 25 Jul 2024
avatar LadySolveig LadySolveig - change - 25 Jul 2024
The description was changed
avatar LadySolveig LadySolveig - edited - 25 Jul 2024
avatar LadySolveig LadySolveig - change - 25 Jul 2024
The description was changed
avatar LadySolveig LadySolveig - edited - 25 Jul 2024
avatar LadySolveig LadySolveig - change - 25 Jul 2024
The description was changed
avatar LadySolveig LadySolveig - edited - 25 Jul 2024
avatar bembelimen bembelimen - test_item - 25 Jul 2024 - Tested successfully
avatar bembelimen
bembelimen - comment - 25 Jul 2024

I have tested this item ✅ successfully on 1e2cb33

Also tested with child-template overrides. Works great. Thanks for the PR!


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43829.

avatar LadySolveig
LadySolveig - comment - 25 Jul 2024

If you have time, I can ask you to repeat your test again. I have revised the testing instuctions and the PR once again. @webnet-assmann Thank you ?

avatar brianteeman
brianteeman - comment - 25 Jul 2024

Why is it that when per template is enabled I can only chose the layout and enable/disable the logo. Why can I not change the logo

avatar LadySolveig
LadySolveig - comment - 25 Jul 2024

I thought of a single place for the logo brand. and only for the deactivation so that it is not attached if the logo is not present in the template override.

Would prefer to create a follow up PR for this additional option in conjunction with @Fedik suggestion for an Image API here #43829 (comment)

avatar brianteeman
brianteeman - comment - 25 Jul 2024

If I can change the mail template I should also be able to change the image file. For example the dimensions of the image file might not be appropriate for every template but there are many reasons to want to change the image used. Am I missing some reasoning that explains why I woudl not want to do that

avatar LadySolveig
LadySolveig - comment - 25 Jul 2024

It was a really good point that it is possible to have an override without an image, and then the image shouldn't be attached either.
As in your example, outputting the log in the header.
But changing the image per template is an improvement that is outside the scope of this PR.

As mentioned, that would be a good improvement for an additional PR, as also adding an API for the inline attachments.

avatar brianteeman
brianteeman - comment - 25 Jul 2024

I dont understand your logic for not allowing the image to be changed. To me it devalues the usefulness of having per mail layouts but I am not going to block it

avatar coolcat-creations
coolcat-creations - comment - 25 Jul 2024

how about solving the image "issue" like that, that the image must be always in a path with the template name? I totally see the need for different logos on several sites.

avatar bembelimen
bembelimen - comment - 25 Jul 2024

Why then not just making a PR when this is merged?

avatar coolcat-creations
coolcat-creations - comment - 25 Jul 2024

Why then not just making a PR when this is merged?

That would be fine too — otherwise the feature is lost in discussion.

avatar brianteeman brianteeman - test_item - 25 Jul 2024 - Tested successfully
avatar brianteeman
brianteeman - comment - 25 Jul 2024

I have tested this item ✅ successfully on 1e2cb33


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43829.

avatar chmst chmst - test_item - 25 Jul 2024 - Tested successfully
avatar chmst
chmst - comment - 25 Jul 2024

I have tested this item ✅ successfully on 1e2cb33


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43829.

avatar chmst chmst - change - 25 Jul 2024
Status Pending Ready to Commit
avatar chmst
chmst - comment - 25 Jul 2024

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43829.

avatar exlemor exlemor - test_item - 25 Jul 2024 - Tested successfully
avatar exlemor
exlemor - comment - 25 Jul 2024

I have tested this item ✅ successfully on 1e2cb33

I was able to test this successfully.

As discussed with Martina, I should note that Scenarios 1-5, I had my Mailer set to PHP Mail and they worked fine, Scenario 6 gave an Could not instantiate mail function but when I switched the mailer to Sendmail that scenario worked. Scenario 7 worked on PHP Mail.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43829.

avatar LadySolveig LadySolveig - change - 25 Jul 2024
The description was changed
avatar LadySolveig LadySolveig - edited - 25 Jul 2024
avatar Fedik
Fedik - comment - 26 Jul 2024

save the base html layout in the database so people can adapt it easily

No please, it is like saving index.php of the main template in database.
It will be huge and unpractical.

avatar HLeithner
HLeithner - comment - 26 Jul 2024

save the base html layout in the database so people can adapt it easily

No please, it is like saving index.php of the main template in database. It will be huge and unpractical.

tbh, we need to be more user friendly for end users and they are unable (or don't want to) to touch php documents.
In the provided layout is nothing fancy that needs php.

avatar Fedik
Fedik - comment - 26 Jul 2024

This kind of thing is for "advanced user", it is not average HTML that can be edited in TinyMCE.
However the layout can be provided as part of the site template (by template developers), and it can be edited as any other template file.

avatar LadySolveig
LadySolveig - comment - 26 Jul 2024

@HLeithner Is that what you mean by user friendly if I have to remember to adapt several templates (for each language one) individually in backend just because I want to change a mail from address for a single use case (MailTemplate), for example? ;)

avatar HLeithner
HLeithner - comment - 26 Jul 2024

yeah don't care anyway please just fix the broken database query thanks

avatar LadySolveig LadySolveig - change - 26 Jul 2024
Labels Added: RTC
avatar brianteeman
brianteeman - comment - 26 Jul 2024

I suspect most people will just be happy to have real html emails with the default layout - I know I am

avatar LadySolveig LadySolveig - change - 26 Jul 2024
The description was changed
avatar LadySolveig LadySolveig - edited - 26 Jul 2024
avatar Hackwar
Hackwar - comment - 26 Jul 2024

I'm merging this even though since this was set to RTC, additional changes were made. However those changes were basically codestyle fixes and have been reviewed by me.

Thank you for your contribution @LadySolveig! This will be a great feature.

avatar Hackwar Hackwar - change - 26 Jul 2024
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2024-07-26 21:14:08
Closed_By Hackwar
avatar Hackwar Hackwar - close - 26 Jul 2024
avatar Hackwar Hackwar - merge - 26 Jul 2024
avatar rbuelund
rbuelund - comment - 7 Oct 2024

I have tried the new main template feature, but I cannot seem to find the posibility for an override of the layout in the Cassiopeia template ?? Where should that be ?


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43829.

avatar LadySolveig
LadySolveig - comment - 7 Oct 2024

grafik
@rbuelund you can create an override directly in the backend in Cassiopeia. Use Layouts -> joomla -> mail.

avatar rbuelund
rbuelund - comment - 7 Oct 2024

Ahh sorry - found it now.

Add a Comment

Login with GitHub to post a comment