I was installing roundcube webclinet on my server and both SMTP and IMAP server using TTLS for encrypted connection. However, I used Lets Encrypt SSL certificate. The PHP couldn’t validate the certificate when configuring roundcube. Therefore, it couldn’t establish connection to SMTP and IMAP.
here is the command to test the SSL on you SMTP and IMAP servers:
~$ openssl s_client -connect example.ir:25 -starttls smtp
To fix this issue ( after long hours of search ) the PHP SSL validation must be switched off in the config.inc.php file. Here is the lines that need to be added:
///////////// disbaled Certificate file check, otherwise wont loging ///////////// added by Saeed $config['default_host'] = 'localhost'; //yourimap server address $config['default_port'] = 143; // IMAP AUTH type (DIGEST-MD5, CRAM-MD5, LOGIN, PLAIN or null to use // best server supported one) $config['imap_conn_options'] = array( 'ssl' => array( 'verify_peer' => false, 'verify_peer_name' => false, 'verify_depth' => 3, 'cafile' => '/etc/openssl/certs/ca.crt', ), ); $config['smtp_server'] = 'tls://localhost'; $config['smtp_conn_options'] = array( 'ssl' => array( 'verify_peer' => false, 'verify_peer_name' => false, 'verify_depth' => 3, 'cafile' => '/etc/openssl/certs/ca.crt', ), );
Best of luck.
— Saeed 🙂
BTC: bc1qrxmjgsc5a2fwn7zplpcu7665uq39tp2ss7luwk