User tests: Successful: Unsuccessful:
Pull Request for Issue #39492 .
--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.
mailtemplate.php
for rendering mail content with sitename in footer and optional logo.MailtemplateLayoutField
to list available mail template layouts (overrides) from (frontend) templates.MailTemplate
class to handle layout data and render email content using the specified layout.config.xml
to enable/disable HTML layout and select a mail template layout globally.template.xml
to include options for disabling HTML layout and selecting a mail template layout individual for each template.TemplateModel
to remove HTML layout fields when the mail style is set to plaintext.Set Mail Format
--> HTML
Setup global Mail Templates configration for Mail Template Layouts as follows:
Per Template Settings are disabled
in the Global Configuration:
Go to System
--> Mail Templates
--> open Global Configuration: Test Mail
No additonal options in template edit view and the global settings are used.
Go to System
--> Global Configuration
--> Tab: Server
Scroll to the bottom and send out test mail
Your Test Mail should look similar like this
Per Template Settings are enabled
in the Global Configuration:
Send the test mail again - the mail should look the same as in the previous step.
Go to System
--> Mail Templates
--> open Global Configuration: Test Mail
Your Test Mail should look similar like this
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
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
Your Test Mail should look similar like this
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
Go to System
--> Global Configuration
--> Mail Templates
Your Test Mail should look similar like this
Go to System
--> Global Configuration
--> Mail Templates
Choose your layout override
Go to System
--> Site Templates
--> open your Template
Open file html --> joomla --> mail --> mailtemplate.php
and add this text
{METHOD}
Your Test Mail should look similar like this
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
Status | New | ⇒ | Pending |
Category | ⇒ | Administration Language & Strings Layout Libraries |
Labels |
Added:
Feature
Language Change
PR-5.2-dev
|
@brianteeman if you want to change it by review in the language files I can commit directly :)
I am really happy to see this. It's the missing link to truly make branded html mails.
Basic functionality all works great.
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
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. ?
Awesome, can one create a signature somewhere and embed it in the mail template?
Thank you!!!
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
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.
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)
Thank you for the additional check @brianteeman
I will address your other comment later this evening and give an update ??
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
@coolcat-creations you can create a complete layout override in your frontend template for this purpose ??
love it!
I have tested this item ✅ successfully on abe2893
great effort !
@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.
Per Template Settings are disabled
in the Global Configuration:
Per Template Settings are enabled
in the Global Configuration:
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.
Title |
|
I have tested this item ✅ successfully on 1e2cb33
Also tested with child-template overrides. Works great. Thanks for the PR!
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 ?
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
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)
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
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.
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
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.
Why then not just making a PR when this is merged?
Why then not just making a PR when this is merged?
That would be fine too — otherwise the feature is lost in discussion.
I have tested this item ✅ successfully on 1e2cb33
I have tested this item ✅ successfully on 1e2cb33
Status | Pending | ⇒ | Ready to Commit |
RTC
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.
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.
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.
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.
@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? ;)
yeah don't care anyway please just fix the broken database query thanks
Labels |
Added:
RTC
|
I suspect most people will just be happy to have real html emails with the default layout - I know I am
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.
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 |
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 ?
Ahh sorry - found it now.
Can I suggest changing this
to