[OJS 3.5.0.1] gmail configuration fails with SSL: Connection reset by peer

Describe the issue or problem
After upgrading to 3.5.0, all emails sent via OJS end up in spam, probably due to subtle changes in DMARC compliance in the latter version. Since control over our server infrastructure is limited, I’m looking for a more solid SMTP configuration for our journal than the mail server on our system. I’m trying to configure SMTP via gmail, following the instructions at https://docs.pkp.sfu.ca/admin-guide/en/deploy-email#gmail.

There seems to be a problem, however: whenever sending a mail via OJS, following error is logged:

[Fri Oct 10 08:01:47.254481 2025] [php:notice] [pid 13:tid 13] [client 172.26.0.8:48212] Connection could not be established with host "ssl://smtp.gmail.com:465": stream_socket_client(): SSL: Connection reset by peer, referer: https://my.journal.org/index.php/test/management/settings/access

Steps I took leading up to the issue
Configured email in config.inc.php as follows:

smtp = On
smtp_server = smtp.gmail.com
smtp_port = 465
smtp_auth = ssl
smtp_username = <email>
smtp_password = <password>
allow_envelope_sender = On
default_envelope_sender = <email>
force_default_envelope_sender = On
force_dmarc_compliant_from = On

…and trying to send test emails via the Settings > Users & Roles page.

Result:

  • no email is delivered
  • logs show message
[Fri Oct 10 08:01:47.254481 2025] [php:notice] [pid 13:tid 13] [client 172.26.0.8:48212] Connection could not be established with host "ssl://smtp.gmail.com:465": stream_socket_client(): SSL: Connection reset by peer, referer: https://my.journal.org/index.php/test/management/settings/access

What application are you using?
OJS 3.5.0-1