I have successfully used Amazon to send emails until today. Today I could not send a single letter and the point is in the CRM itself. I have not changed anything in the settings and have not updated the CRM. I will attach a correspondence with the hosting technical support to clarify the essence of the problem.
I cannot send emails via Amazon. Yesterday everything worked, today it gives an error. Checked my Amazon account, so everything is fine. Here is the error from the log file.
[2021-05-28 08:21:15] WARNING: E_WARNING: stream_socket_enable_crypto(): Peer certificate CN=`server.aaaaaex.com' did not match expected CN=`email-smtp.eu-west-2.amazonaws.com' {"code":2,"message":"stream_socket_enable_crypt o() : Peer certificate CN=`server.aaaarex.com' did not match expected CN=`email-smtp.eu-west-2.amazonaws.com'","file":"/home/aaaaex/public_html/crm/vendor/laminas/laminas-mail/src/Protocol/Smtp.php","line":216} [] [2021-05-28 08:21:15] ERROR: Email sending error. Unable to connect via TLS [] [] [2021-05-28 08:21:15] ERROR: Email sending:Email sending error.; 500 [] []
Amazon isn't the problem. I tried sending via a different SMTP and got a similar error. Last time you opened a port to fix this error.
[2021-05-28 08:36:29] ERROR: Email sending error. Could not open socket: stream_socket_client(): unable to connect to ssl://email-smtp.us-west-2.amazonaws.com:465 (Connection refused) [] [] [2021-05-28 08:36:29] ERROR: Email sending:Email sending error.; 500 [] []
I have tested the connectivity with Amazon using the command line on your server. its properly working : https://pastebin.com/nF4h0ZMw
So the port is open and the connection is happening. There must be something else preventing the application from connecting , or the log record is wrong.
These are the settings in EspoCrm
I tried changing ports but it didn't help.
The code doesn't help much, but:
[2021-05-28 09:20:39] WARNING: E_WARNING: stream_socket_enable_crypto(): Peer certificate CN=`server.aaaaex.com' did not match expected CN=`email-smtp.eu-west-2.amazonaws.com' {"code":2,"message":"st re am_socket_enable_crypto(): Peer certificate CN=`server.aaaaax.com' did not match expected CN=`email-smtp.eu-west-2.amazonaws.com'","file":"/home/azaaaax/public_html/crm/vendor/laminas/laminas-mail/src/Protocol/Smtp.php","line":216} []
[2021-05-28 09:20:39] ERROR: Email sending error. Unable to connect via TLS [] []
[2021-05-28 09:20:39] ERROR: Email sending:Email sending error.; 500 [] []
The error message "Peer certificate CN=`server.aaaaaaax.com' did not match expected CN=`email-smtp.eu-west-2.amazonaws.com'" means that there is a confusion between the incoming and outgoing connections.
Maybe the app doesn't expect that the SMTP and the IMAP settings can be different? This error looks really strange.
Please check this with the app developers as network connectivity is definitely not the issue in this case.
But yesterday everything worked, I sent emails in the evening. I have not changed anything in the settings or updated. The only thing I did yesterday was changing the encoding of the databases in MySql from utfmb4_unicode_ci to utf8_unicode_ci, and today again for some reason I see the encoding utfmb4_unicode_ci
I changed the encoding, but it didn't help
The application email settings look completely fine.
The network connectivity with the amazon services has been checked and confirmed (on both ports 465 and 587)
There must be something in the application code that prevents the email feature from working properly.
Since the detected SSL certificate appears to be reported as an issue in the provided logs - I would recommend you to try setting us email communication using the standard non-ssl ports. 143 for IMAP and 25 for SMTP (disabling the starttls or SSL options accordingly).
As I have already mentioned, try using the non SSL standard ports.
I tried various settings but it didn't work.
[2021-05-28 10:37:34] WARNING: E_WARNING: stream_socket_enable_crypto(): Peer certificate CN=`server.aaaaaaaex.com' did not match expected CN=`email-smtp.eu-west-2.amazonaws.com' {"code":2,"message":"st re am_socket_enable_crypto(): Peer certificate CN=`server.aaaaaax.com' did not match expected CN=`email-smtp.eu-west-2.amazonaws.com'","file":"/home/aaaaaaex/public_html/crm/vendor/laminas/laminas-mail/src/Protocol/Smtp.php","line":216} []
[2021-05-28 10:37:34] ERROR: Email sending error. Unable to connect via TLS [] []
[2021-05-28 10:37:34] WARNING: Email sending:Email sending error.; 500 [] []
[2021-05-28 10:42:55] ERROR: (0) cannot connect to host ; error = fsockopen(): unable to connect to ssl://mail.aaaaaex.com:143 (Unknown error) (errno = 0 ); POST /EmailAccount/action/testConnection; line: 94, file: /home/aaaaaax/public_html/crm/vendor/laminas/laminas-mail/src/Protocol/Imap.php [] []
[2021-05-28 10:43:34] WARNING: E_WARNING: stream_socket_enable_crypto(): Peer certificate CN=`server.aaaaaax.com' did not match expected CN=`email-smtp.eu-west-2.amazonaws.com' {"code":2,"message":"st re am_socket_enable_crypto(): Peer certificate CN=`server.aaaaaax.com' did not match expected CN=`email-smtp.eu-west-2.amazonaws.com'","file":"/home/aaaaaaex/public_html/crm/vendor/laminas/laminas-mail/src/Protocol/Smtp.php","line":216} []
[2021-05-28 10:43:34] ERROR: Email sending error. Unable to connect via TLS [] []
[2021-05-28 10:43:34] WARNING: Email sending:Email sending error.; 500 [] []
[2021-05-28 10:43:53] WARNING: E_WARNING: stream_socket_enable_crypto(): Peer certificate CN=`server.aaaaaax.com' did not match expected CN=`email-smtp.eu-west-2.amazonaws.com' {"code":2,"message":"st re am_socket_enable_crypto(): Peer certificate CN=`server.aaaaaaax.com' did not match expected CN=`email-smtp.eu-west-2.amazonaws.com'","file":"/home/aaaaaax/public_html/crm/vendor/laminas/laminas-mail/src/Protocol/Smtp.php","line":216} []
[2021-05-28 10:43:53] ERROR: Email sending error. Unable to connect via TLS [] []
[2021-05-28 10:43:53] WARNING: Email sending:Email sending error.; 500 [] []
[2021-05-28 10:44:40] ERROR: Email sending error. Could not open socket: stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages: error:1408F10B:SSL routines:ssl3_get_record:wrong version number [] []
[2021-05-28 10:44:40] WARNING: Email sending:Email sending error.; 500 [] []
[2021-05-28 10:45:54] ERROR: (0) cannot connect to host ; error = fsockopen(): unable to connect to ssl://mail.aaaaaaex.com:143 (Unknown error) (errno = 0 ); POST /EmailAccount/action/testConnection; line: 94, file: /home/aaaaaaex/public_html/crm/vendor/laminas/laminas-mail/src/Protocol/Imap.php [] []
[2021-05-28 10:46:15] ERROR: Email sending error. Could not open socket: stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages: error:1408F10B:SSL routines:ssl3_get_record:wrong version number [] []
[2021-05-28 10:46:15] WARNING: Email sending:Email sending error.; 500 [] []
[2021-05-28 10:46:28] WARNING: E_WARNING: stream_socket_enable_crypto(): Peer certificate CN=`server.aaaaaax.com' did not match expected CN=`email-smtp.eu-west-2.amazonaws.com' {"code":2,"message":"st re am_socket_enable_crypto(): Peer certificate CN=`server.aaaaaaaex.com' did not match expected CN=`email-smtp.eu-west-2.amazonaws.com'","file":"/home/aaaaaax/public_html/crm/vendor/laminas/laminas-mail/src/Protocol/Smtp.php","line":216} []
[2021-05-28 10:46:28] ERROR: Email sending error. Unable to connect via TLS [] []
[2021-05-28 10:46:28] WARNING: Email sending:Email sending error.; 500 [] []
Unfortunately, code level troubleshooting is out of our scope of support.
We are not familiar with the application software you are using, so we can only check and confirm if the network connectivity works for the specified email services or not.
I do not know how exactly the app is supposed to be sending emails. I understand that the library in use is "laminas" and the component is "laminas-mail", but this doesn't really help me to understand why the application acting as described.
Maybe switching the app to use another email plugin will help, I can't be really sure on that.
Only the application developer can help you with this.
Please, help
Comment