Hello everyone,
I’m experiencing a persistent issue with OJS 3.4 and 3.5 while trying to configure email delivery via SMTP. Previously, with OJS 3.3, our setup worked perfectly, but it no longer functions in the newer versions.
Our Configuration
We need to send emails using an SMTP server on port 25 without any authentication or encryption.
Here’s our config.inc.php email section:
[email]
default = smtp
smtp = On
smtp_server = smtp.university.edu
smtp_port = 25
smtp_auth = Off
smtp_username =
smtp_password =
smtp_secure = none
The Problem
When trying to send an email, we consistently get the following error in the Apache logs:
Unable to connect with STARTTLS: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages: error:0A000102:SSL routines::unsupported protocol
This error suggests that OJS is still trying to initiate a STARTTLS handshake, despite smtp_secure being set to none.
What We’ve Tried
To bypass the STARTTLS issue, we have made the following code modifications in the core OJS files:
-
Modified
PHPMailerTransport.php: We changed the code to ensureisSMTP()is used and to explicitly disable security.-
Changed
$mailer->isMail()to$mailer->isSMTP(). -
Added
$mailer->SMTPAutoTLS = false;and$mailer->SMTPSecure = '';to thegetPHPMailerMessagefunction.
-
-
Modified vendor files: We applied a fix to the
startTLSfunctions in both PHPMailer and Symfony Mailer to force them to returnfalse, preventing the TLS handshake.-
In
./lib/pkp/lib/vendor/phpmailer/phpmailer/src/SMTP.php, thestartTLS()function was changed toreturn false;. -
In
./lib/pkp/lib/vendor/symfony/mailer/Transport/Smtp/Stream/SocketStream.php, thestartTls()function was also changed toreturn false;.
-
After these changes, the STARTTLS error disappeared, but we started getting a “Connection to ‘smtp.university.edu:25’ timed out.” error instead.
We’ve confirmed that a telnet connection and a basic PHP fsockopen() script both work perfectly from the server’s command line to smtp.university.edu:25. This indicates the issue is not a network or firewall problem, but something specific within the OJS application’s code or its mailer libraries.
Any help or insights on this issue would be greatly appreciated. Thank you!