GoodNews not sending emails (500 to connector.php)

Whenever I try to send a test email of a newsletter (or the entire newsletter itself) I get a never ending loading/sending bar, but nothing ever happens.

There’s no errors in the error log (despite having debug mode enabled) but the console shows a 500 error to

https://domain.tld/assets/components/goodnews/connector.php

Status           500
Version          HTTP/2
Transferred      1.34 kB (0 B size)
Referrer Policy  strict-origin-when-cross-origin
Request Priority Highest
DNS Resolution   System

Also there were a ton of warnings regarding

Cookie “PHPSESSID” does not have a proper “SameSite” attribute value.

I’m not really sure what is going wrong here. I did some research regarding the Cookie and I tried setting the session_cookie_secure to Yes and also session_cookie_samesite to Strict but although the warnings for the Cookie disappeared, the 500 still persists.

Any ideas?
Also I hope it’s fine if I tag you here @gadgetto

MODX 3.0.4
PHP 8.2.11
GoodNews 2.0.0-alpha2

Did you check the server error log or only the log from MODX?

Just checked the server log.

I get this entry about every second:

200	POST /assets/components/goodnews/connector.php HTTP/1.0

When I try to send the test email again I get this:

Warning	  mod_fcgid: stderr: PHP Fatal error: Uncaught Error: Undefined constant MODX\\Revolution\\Mail\\modMail::MAIL_SMTP_PREFIX in /var/www/domain.tld/cms/core/components/goodnews/src/Mailer.php:849, referer: https://domain.tld/manager/?a=index&namespace=goodnews				Apache-Error
Warning	  mod_fcgid: stderr: Stack trace:, referer: https://domain.tld/manager/?a=index&namespace=goodnews				Apache-Error
Warning	  mod_fcgid: stderr: #0 /var/www/domain.tld/cms/core/components/goodnews/src/Mailer.php(767): Bitego\\GoodNews\\Mailer->sendEmail(Array, Array), referer: https://domain.tld/manager/?a=index&namespace=goodnews				Apache-Error
Warning	  mod_fcgid: stderr: #1 /var/www/domain.tld/cms/core/components/goodnews/src/Processors/Send/SendTest.php(46): Bitego\\GoodNews\\Mailer->processTestMailing('67'), referer: https://domain.tld/manager/?a=index&namespace=goodnews				Apache-Error
Warning	  mod_fcgid: stderr: #2 /var/www/domain.tld/cms/core/src/Revolution/Processors/Processor.php(189): Bitego\\GoodNews\\Processors\\Send\\SendTest->process(), referer: https://domain.tld/manager/?a=index&namespace=goodnews				Apache-Error
Warning	  mod_fcgid: stderr: #3 /var/www/domain.tld/cms/core/src/Revolution/modX.php(1757): MODX\\Revolution\\Processors\\Processor->run(), referer: https://domain.tld/manager/?a=index&namespace=goodnews				Apache-Error
Warning	  mod_fcgid: stderr: #4 /var/www/domain.tld/cms/core/src/Revolution/modConnectorResponse.php(151): MODX\\Revolution\\modX->runProcessor('Bitego\\\\GoodNews...', Array, Array), referer: https://domain.tld/manager/?a=index&namespace=goodnews				Apache-Error
Warning	  mod_fcgid: stderr: #5 /var/www/domain.tld/cms/core/src/Revolution/modConnectorRequest.php(89): MODX\\Revolution\\modConnectorResponse->outputContent(Array), referer: https://domain.tld/manager/?a=index&namespace=goodnews				Apache-Error
Warning	  mod_fcgid: stderr: #6 /var/www/domain.tld/cms/core/src/Revolution/modConnectorRequest.php(77): MODX\\Revolution\\modConnectorRequest->prepareResponse(Array), referer: https://domain.tld/manager/?a=index&namespace=goodnews				Apache-Error
Warning	  mod_fcgid: stderr: #7 /var/www/domain.tld/cms/assets/components/goodnews/connector.php(28): MODX\\Revolution\\modConnectorRequest->handleRequest(Array), referer: https://domain.tld/manager/?a=index&namespace=goodnews				Apache-Error
Warning	  mod_fcgid: stderr: #8 {main}, referer: https://domain.tld/manager/?a=index&namespace=goodnews				Apache-Error
Warning	  mod_fcgid: stderr: thrown in /var/www/domain.tld/cms/core/components/goodnews/src/Mailer.php on line 849, referer: https://domain.tld/manager/?a=index&namespace=goodnews				Apache-Error

So something about a MAIL_SMTP_PREFIX? Is this referring to a setting from me or something within GoodNews?

Within my container the SMTP connection prefix is set to ssl. This is the exact same setup as on a different site (except the other is MODX2) with the same provider and email settings.

I believe this setting has been renamed to MAIL_SMTP_SECURE in MODX 3.
So the code (in core/components/goodnews/src/Mailer.php) has to be adapted for MODX 3.

That’s probably it. I changed the following and now emails are sending fine:

817  $this->modx->getOption('mail_smtp_prefix', null, '')     // old
817  $this->modx->getOption('mail_smtp_secure', null, '')     // new

849  $mail->set(modMail::MAIL_SMTP_PREFIX, $mailSmtpPrefix);  // old
849  $mail->set(modMail::MAIL_SMTP_SECURE, $mailSmtpPrefix);  // new

Is there anything else I should look out for?

Is it correct, that the connector.php is accessed every second?

I will also open an issue on github for this.

I never used GoodNews and I’m not familiar with the code.

What’s the “action” parameters (the processor that gets executed) of those requests?

Ah, it’s Bitego\GoodNews\Processors\Mailing\Cron\Ping and the response shows that this is the part showing how many seconds ago the scheduler was reached. I guess that’s fine then.