Mail is not working for activation and/or password reset

Everwijn Overberg Posted in Technical Support 4 years ago

Hello,

Yesterday I installed OSSN for the first time in my life and all seemed to have gone without problems.
However, after the install it appears no mail is sent out through PhP but also not through SMTP.

I checked this with my host. A regular php mailer simply works, so it appears to be a problem in OSSN and I have no idea how to find or fix it.

I allready installed System info but it is giving me nothing I can use it seems. No errors so I am at a loss.

I would appreciate a little help :-)

Replies
German Michael Zülsdorff Replied 4 years ago

yeah, of course this code needs something under the hood which most likely IS available with your PHP 7.0 but ISN'T with PHP 7.4.
You may investigate this by running phpinfo, switch to the other PHP, run phpinfo again and check the line
Registered Stream Socket Transports for differences.

with 7.4.5 I'm getting tcp, udp, unix, udg, ssl, tls, tlsv1.0, tlsv1.1, tlsv1.2, tlsv1.3

Dutch Everwijn Overberg Replied 4 years ago

Well, I did this with tech support from my host so I have no clue if what they told me is correct, but they said the problem was in this piece of code:

public function startTLS()
{
if (!$this->sendCommand('STARTTLS', 'STARTTLS', 220)) {
return false;
}
//Allow the best TLS version(s) we can
$cryptomethod = STREAMCRYPTOMETHODTLSCLIENT;
//PHP 5.6.7 dropped inclusion of TLS 1.1 and 1.2 in STREAM
CRYPTOMETHODTLSCLIENT
//so add them back in manually if we can
if (defined('STREAM
CRYPTOMETHODTLSv12CLIENT')) {
$cryptomethod |= STREAMCRYPTOMETHODTLSv12CLIENT;
$cryptomethod |= STREAMCRYPTOMETHODTLSv11CLIENT;
}
// Begin encrypted connection
if (!streamsocketenablecrypto(
$this->smtp
conn,
true,
$crypto_method
)) {
return false;
}
return true;
}

German Michael Zülsdorff Replied 4 years ago

Okay, verified now.
I switched my hosting package to PHP 7.4
and configured the SMTP component to use an encrypted connection via port 587:
No issues.

Thus, as already assumed, there's something missing/wrong in your php 7.4 configuration.

German Michael Zülsdorff Replied 4 years ago

Well, I wouldn't want to call it 'solved'.

Php 7 is fairly outdated on one hand, and from the error message you got, to my opinion this isn't a Ossn issue but results from a php 7.4 configuration problem on your host.

I'll try to verify 7.4 on my own host (currently running php 7.3 without problems )

Dutch Everwijn Overberg Replied 4 years ago

Found the problem. It appears that OSSN does not like Php 7.4.

Set it to Php 7 and everything works now.

Solved!

German Michael Zülsdorff Replied 4 years ago

Okay, so your smtp server seems to be basically fine,
although doing a successful test with an external client like smtper.net doesn't necessarely mean that your internal php/ssl configuration has been setup correctly. So it's makes sense to provide the certificate related error message to your provider and ask him to verify.
Aside from that there are dozens of results on the web when searching for
phpmailer ssl certificate verify failed
One solution i found at https://stackoverflow.com/questions/32694103/phpmailer-openssl-error

So you may try to add that

$mail->SMTPOptions = array(
'ssl' => array(
    'verify_peer' => false,
    'verify_peer_name' => false,
    'allow_self_signed' => true
));

in the ossn_com.php file of the SMTP component in the function named ossn_smtp below the line

$mail->Password = $settings->password;
Dutch Everwijn Overberg Replied 4 years ago

mail.urubin.nl

Which worked fine with smtper.net(test script) and Php mailer script
When I set it in the SMTP settings in OSSN it also says connection established it just won't send.

I did add a LET's certificate whcih seemed fine also?

German Michael Zülsdorff Replied 4 years ago

Which smtp server are you trying to connect to?
seems like that server has no or no valid certificate

Dutch Everwijn Overberg Replied 4 years ago

Some additional info:

I checked the error log and I see:

[14-Jul-2020 02:24:17 Europe/Amsterdam] PHP WARNING: 2020-07-14 02:24:17 (CEST): "streamsocketenablecrypto(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3
getservercertificate:certificate verify failed" in file /home/urubin/domains/urubin.nl/public_html/classes/mail/class.smtp.php (line 368)

I am no expert. Is there anybody here who can tell me what that means and if this could be causing the problem?