? ? Pending

User tests: Successful: Unsuccessful:

avatar nikosdion
nikosdion
31 May 2022

Pull Request for Issue #37933.

Summary of Changes

When System, Mail Templates, Options, “Per Template Mail Settings” is set to Yes the mail templates feature ignores each individual mail template's “Set Mail” option if the latter is set to No. As a result, setting “Per Template Mail Settings” to Yes requires that all email templates duplicate the mailer configuration from the site's Global Configuration.

This PR fixes this problem by making each individual email template's “Set Mail” setting actually work.

I also changed the default value of the “Set Mail” to No because it is unlikely that you want to override every single customised mail template's mailer settings. In all likelihood you are customising a lot of mail templates to fit your branding but you only want custom mail settings (typically to implement a different sender or reply to address) for a small subset of them, e.g. the mail templates which are used to send out invoices / receipts on an e-commerce site. Having “Set Mail” enabled by default, in a secondary tab most people will miss, is a great way to make people think Joomla is broken and can't send emails...

Testing Instructions

  • Make sure your PHP cannot send emails with mail(). For example, edit your php.ini and set
    [mail function]
    sendmail_path=/usr/local/foobar
  • Go to System, Global Configuration, Server and set up your Mail options. I am using MailHog on my local server (SMTP on localhost:1025) for my local testing. You can use whatever works for you.
  • Make sure your site can send emails using the “Send Test Email” button.
  • Click on Save & Close.
  • Go to System, Mail Templates, Options.
  • Set “Per Template Mail Settings” to Yes.
  • Click on Save & Close.
  • Go to System, Mail Templates.
  • Click on the “Global Configuration: Test Mail” item.
  • Go to the Options tab.
  • Set Mail Settings to No.
  • Click on Save & Close.
  • Go to System, Global Configuration, Server tab.
  • Click on the “Send Test Email” button.

Actual result BEFORE applying this Pull Request

Error message, e.g.:

SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

Expected result AFTER applying this Pull Request

A test email is sent using the Global Configuration settings.

Documentation Changes Required

None.

Additional comments

This has been broken ever since the introduction of the Mail Templates feature in Joomla 4 back in September 2019.

Hat tip to my client, EJ, for reporting this problem and letting me use a backup of his site to verify the conditions which trigger it.

avatar nikosdion nikosdion - open - 31 May 2022
avatar nikosdion nikosdion - change - 31 May 2022
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 31 May 2022
Category Administration Libraries
avatar Kostelano Kostelano - test_item - 31 May 2022 - Tested successfully
avatar Kostelano
Kostelano - comment - 31 May 2022

I have tested this item successfully on 71ac7bb

It works! Tested on 4.2 by changing the lines of code according to the PR.


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

avatar richard67
richard67 - comment - 31 May 2022

Can issue #37933 be closed because solved with this PR?

avatar nikosdion
nikosdion - comment - 31 May 2022

@richard67 Sure. I also made the commit comment so it auto-closes the issue when the PR is merged ;)

avatar richard67
richard67 - comment - 31 May 2022

@richard67 Sure. I also made the commit comment so it auto-closes the issue when the PR is merged ;)

@nikosdion Well here in this repo we close an issue as soon as a PR is made, not when it is merged. It was always like that as far as I remember since we are on GitHub.

avatar nikosdion
nikosdion - comment - 1 Jun 2022

@richard67 Yup, I know. I always add a reference to the issue when submitting a PR against an issue to save a future developer running git blame yet another step in understanding why this code exists / was changed. A necessity born out of personal frustration, if you like. Since it doesn't break anything I keep doing it ?

avatar toivo toivo - test_item - 1 Jun 2022 - Tested successfully
avatar toivo
toivo - comment - 1 Jun 2022

I have tested this item successfully on 71ac7bb

Tested successfully in Joomla 4.1.5-dev of 1 June in Wampserver 3.2.9 using PHP 8.1.6.


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

avatar viocassel viocassel - test_item - 1 Jun 2022 - Tested successfully
avatar viocassel
viocassel - comment - 1 Jun 2022

I have tested this item successfully on 71ac7bb


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

avatar richard67 richard67 - change - 1 Jun 2022
Status Pending Ready to Commit
Labels Added: ?
avatar richard67
richard67 - comment - 1 Jun 2022

RTC


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

avatar bembelimen bembelimen - close - 5 Jun 2022
avatar bembelimen bembelimen - merge - 5 Jun 2022
avatar bembelimen bembelimen - change - 5 Jun 2022
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2022-06-05 22:31:56
Closed_By bembelimen
Labels Added: ?
avatar bembelimen
bembelimen - comment - 5 Jun 2022

Thx

avatar nikosdion
nikosdion - comment - 6 Jun 2022

Thank you for the merge!

Add a Comment

Login with GitHub to post a comment