in2code-de / luxletter

Newsletter system for TYPO3

Home Page:https://www.in2code.de/agentur/typo3-extensions/luxletter/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MAIL_LUXLETTER not working - cannot extend private function

ToGetATockenOnly opened this issue · comments

TYPO3v9 with PHPv7.3
TYPO3v11 with PHPv8.2

bddd1e3

the sendMail() was calling the initializeMailer() within the extended MailMessage class. Since 2021 the call is within the parent class only and the mail settings override is not working as the extended mailer class is not loaded.

If you fix this a new version of luxletter may start loading "old" luxletter mail settings again. Such settings get easily out-of-site in LocalConfiguration.php or .env files. So maybe there should be a warning.

Sorry, I don't get it. Can you please describe more what your configuration was and why did you struggle?

The keyword is "private" in the title. The private function was originally called within the extended class, what is working. With the change referenced above, it would be necessary the private function is called from the parent class, what is not possible. Everything of your class extending is not working. Special mail settings for Luxletter are not working at all. Since 2021..

Okay, and what is e.g. a special mail setting? Can you please add one line of code that you would like to use for a special mail setting that does not work?
Do you mean the settings like:

$GLOBALS['TYPO3_CONF_VARS']['MAIL_LUXLETTER']['transport'] = 'smtp';
$GLOBALS['TYPO3_CONF_VARS']['MAIL_LUXLETTER']['transport_smtp_server'] = 'sslout.de:465';
$GLOBALS['TYPO3_CONF_VARS']['MAIL_LUXLETTER']['transport_smtp_encrypt'] = 'ssl';
$GLOBALS['TYPO3_CONF_VARS']['MAIL_LUXLETTER']['transport_smtp_username'] = 'username';
$GLOBALS['TYPO3_CONF_VARS']['MAIL_LUXLETTER']['transport_smtp_password'] = 'password';
$GLOBALS['TYPO3_CONF_VARS']['MAIL_LUXLETTER']['transport_smtp_port'] = '465';

Yes. You are right. It is about $GLOBALS['TYPO3_CONF_VARS']['MAIL_LUXLETTER']. Such settings are used - or were - used to override $GLOBALS['TYPO3_CONF_VARS']['MAIL'] settings especially for sending mails by Luxletter. But that code is dead since 06.2021.
I just realize, that in my upgrade project the override settings are still active in the TYPO3v9 LIVE version. Oha. Good we are talking about it. Maybe I actually need this functionality.

Is the problem clear now?

Yes, I can reproduce the issue on TYPO3 11 and 12. The originally overwritten function injectMailSettings() is used only for unit tests in TYPO3.
I'm working on a solution.

I just released version 24.0.1 which should resolve this issue. Thank you for reporting and digging into it.

I did a bit of testing, today. Everything is fine. What I want to leave as feedback:

  • the major version change v23 -> v24 makes it necessary for me to go into composer.json, where I usually have version constraints like this ^22.x - this change here may have been handled as a minor change.
  • core Mailer __construct() dispatches an AfterMailerInitializationEvent, which may now be dispatched before the settings may still be changed by Luxletter.

Thx,

  1. The latest release was only a bugfix version - so only an update from 24.0.0 to 24.0.1 was needed
  2. Sure, I also tried to use this event for the task, but the event is nearly useless for this case. If you have a better solution, feel free for a PR