Roundcube Community Forum

 

Sending e-mails fail with error: Unable to connect to ssl://localhost:465

Started by cmonty14, January 07, 2025, 08:45:57 PM

Previous topic - Next topic

cmonty14

Hi,
I have completed setup of self-hosted mailserver based on Dovecot, Postfix and Nginx.
Using a mail client I can receive and send e-mails.

Then I deployed roundcube by installing these Debian packages:
roundcube
roundcube-core
roundcube-pgsql

I can open roundcube WebUI entering this URL: webmail.mydomain.com.

When I try to send an e-mail, I get this error message:
[08-Jan-2025 01:17:18 +0000]: <au41b3b7> PHP Error: fsockopen(): Unable to connect to ssl://localhost:465 (Unknown error) (POST /?_task=mail&_unlock=loading1736299038458&_framed=1&_action=send)
[08-Jan-2025 01:17:18 UTC] PHP Deprecated:  Creation of dynamic property PEAR_Error::$callback is deprecated in /usr/share/php/PEAR.php on line 905
[08-Jan-2025 01:17:18 +0000]: <au41b3b7> PHP Error: Failed to connect socket: fsockopen(): Unable to connect to ssl://localhost:465 (Unknown error) (POST /?_task=mail&_unlock=loading1736299038458&_framed=1&_action=send)
[08-Jan-2025 01:17:18 +0000]: <au41b3b7> SMTP Error: Connection failed:  (Code: -1) in /usr/share/roundcube/program/lib/Roundcube/rcube.php on line 1787 (POST /?_task=mail&_unlock=loading1736299038458&_framed=1&_action=send)
root@mail:~# nano /etc/roundcube/config.inc.php


The error is related to my roundcube configuration:
$config = [];

// Do not set db_dsnw here, use dpkg-reconfigure roundcube-core to configure database!
include("/etc/roundcube/debian-db-roundcube.php");

// IMAP host chosen to perform the log-in.
// See defaults.inc.php for the option description.
//$config['imap_host'] = 'localhost:993';
$config['imap_host'] = 'localhost:143';

// SMTP server host (for sending mails).
// See defaults.inc.php for the option description.
$config['smtp_host'] = 'localhost:465';


After modifying the config by disabling certificate validation the error is not reproducible.
$config['smtp_conn_options'] = array(
    'ssl' => array(
        'verify_peer'       => false,
        'verify_peer_name'  => false,
    ),
);


However I want to use SMTPS: 465/tcp that is working with any other mail client.

Please advise how to fix this issue.

THX