in2code-de / luxletter

Newsletter system for TYPO3
https://www.in2code.de/agentur/typo3-extensions/luxletter/
22 stars 25 forks source link

MAIL_LUXLETTER not working - cannot extend private function #194

Closed ToGetATockenOnly closed 11 months ago

ToGetATockenOnly commented 11 months ago

TYPO3v9 with PHPv7.3 TYPO3v11 with PHPv8.2

https://github.com/in2code-de/luxletter/commit/bddd1e323f285bfe309291741a0c64cf5ebd6dc8

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.

einpraegsam commented 11 months ago

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

ToGetATockenOnly commented 11 months ago

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..

einpraegsam commented 11 months ago

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';
ToGetATockenOnly commented 11 months ago

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.

ToGetATockenOnly commented 11 months ago

Is the problem clear now?

einpraegsam commented 11 months ago

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.

einpraegsam commented 11 months ago

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

ToGetATockenOnly commented 11 months ago

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

einpraegsam commented 11 months ago

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