Jump to content

Unable to send email


Recommended Posts

Hi guys,

I've got following installation:

Prestashop v. 1.7.6.5
MySQL: 5.7.30
PHP: 7.3.17
Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.3.17
 

I'm not able to send "test email" via Prestashop using my dedicated email account. In logs I've found:

[2020-05-14 10:42:15] security.DEBUG: Read existing security token from the session. {"key":"_security_main","token_class":"Symfony\\Component\\Security\\Core\\Authentication\\Token\\UsernamePasswordToken"} []
[2020-05-14 10:42:15] security.DEBUG: User was reloaded from a user provider. {"provider":"PrestaShopBundle\\Security\\Admin\\EmployeeProvider","username":"[email protected]"} []
[2020-05-14 10:42:15] php.DEBUG: Warning: stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\SilencedErrorContext: {\"severity\":2,\"file\":\"/var/www/html/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php\",\"line\":275,\"trace\":[{\"file\":\"/var/www/html/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php\",\"line\":62,\"function\":\"_establishSocketConnection\",\"class\":\"Swift_Transport_StreamBuffer\",\"type\":\"->\"}],\"count\":1})"} []
[2020-05-14 10:42:15] php.DEBUG: Warning: stream_socket_client(): Failed to enable crypto [] []
[2020-05-14 10:42:15] php.DEBUG: Warning: stream_socket_client(): unable to connect to ssl://smtp.babycars.pl:587 (Unknown error) []

But I'm able to send email using this account for example from the shell script (withing the same server):

#!/bin/bash

sendme (){
echo "Please check it" | mailx  -v \
-r "[email protected]" \
-s "TEST" \
-S smtp="smtp.babycars.pl:587" \
-S smtp-use-starttls \
-S smtp-auth=login \
-S smtp-auth-user="[email protected]" \
-S smtp-auth-password="PWD" \
-S ssl-verify=ignore \
-S nss-config-dir=/etc/pki/nssdb/ \
[email protected]
}

sendme

Furthermore, I can send test email from my company's google account. It would suggest that there can be some issue with smtp.babycars.pl but I have no idea what can be the root cause.

The error itself would suggest some SSL issue, perhaps certificate verification fails? Can someone advise how to fix it from PHP side?

# openssl s_client -connect smtp.babycars.pl:587
CONNECTED(00000003)
139631729719184:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:s23_clnt.c:794:
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 7 bytes and written 289 bytes
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
    Protocol  : TLSv1.2
    Cipher    : 0000
    Session-ID: 
    Session-ID-ctx: 
    Master-Key: 
    Key-Arg   : None
    Krb5 Principal: None
    PSK identity: None
    PSK identity hint: None
    Start Time: 1589447644
    Timeout   : 300 (sec)
    Verify return code: 0 (ok)
---

But for gmail I have the same response and sending email works:

# openssl s_client -connect smtp.gmail.com:587
CONNECTED(00000003)
140334499997584:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:s23_clnt.c:794:
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 7 bytes and written 289 bytes
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
    Protocol  : TLSv1.2
    Cipher    : 0000
    Session-ID: 
    Session-ID-ctx: 
    Master-Key: 
    Key-Arg   : None
    Krb5 Principal: None
    PSK identity: None
    PSK identity hint: None
    Start Time: 1589447565
    Timeout   : 300 (sec)
    Verify return code: 0 (ok)
---

Regards

 

 

Edited by tasiorek27 (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...