Author Topic: smtp error(): connection to server failed  (Read 5336 times)

Offline joea

  • Jr. Member
  • **
  • Posts: 15
smtp error(): connection to server failed
« on: November 25, 2023, 11:14:44 AM »
RoundCube 1.6.4 on OpenSuse LEAP 15.5.  Works well except when attempting to send email.  Presents this message "smtp error(): connection to server failed"

Setting smtp debug on logs, on various attempts:

[25-Nov-2023 15:38:24 +0000]: <6gkadrop> Connecting to localhost:587...
[25-Nov-2023 15:53:13 +0000]: <6e3jogto> Connecting to localhost:587...
[25-Nov-2023 15:55:20 +0000]: <6e3jogto> Connecting to localhost:587...
[25-Nov-2023 15:56:01 +0000]: <lovk4tdd> Connecting to localhost:587...
[25-Nov-2023 15:58:14 +0000]: <tt6143b0> Connecting to localhost:587...

In this relatively isolated/secure location, am just using port 25.
There are only two places I find reference to smtp port 587 and have changed both to port 25, yet the error continues.

What I have changed:

/etc/roundcubemail/config.inc.php
//$config['smtp_port'] = 587;
$config['smtp_port'] = 25;

/etc/roundcubemail/defaults.inc.php
//$config['smtp_host'] = 'localhost:587';
$config['smtp_host'] = 'localhost:25';

Have I missed something, or failed to restart/reload something?




Offline joea

  • Jr. Member
  • **
  • Posts: 15
Re: smtp error(): connection to server failed
« Reply #1 on: November 25, 2023, 02:05:03 PM »
FYI - from /var/log/roundcubemail/errors

1794 (POST /roundcube/?_task=mail&_unlock=loading1700938242349&_framed=1&_action=send)
[25-Nov-2023 18:51:26 +0000]: <ksu0gnd6> PHP Error: Connection refused (POST /roundcube/?_task=mail&_unlock=loading1700938286350&_framed=1&_action=send)
[25-Nov-2023 18:51:26 +0000]: <ksu0gnd6> PHP Error: Failed to connect socket: Connection refused (POST /roundcube/?_task=mail&_unlock=loading1700938286350&_framed=1&_action=send)
[25-Nov-2023 18:51:26 +0000]: <ksu0gnd6> SMTP Error: Connection failed:  (Code: -1) in /usr/share/php/Roundcube/rcube.php on line 1794 (POST /roundcube/?_task=mail&_unlock=loading1700938286350&_framed=1&_action=send)

Why does RC continue to try port 587?  Dovecot makes nice with port 25 and sends from any of the accounts.  RC, from none, obviously.

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,856
Re: smtp error(): connection to server failed
« Reply #2 on: November 25, 2023, 03:06:50 PM »
Quote
What I have changed:

/etc/roundcubemail/config.inc.php
//$config['smtp_port'] = 587;
$config['smtp_port'] = 25;

/etc/roundcubemail/defaults.inc.php
//$config['smtp_host'] = 'localhost:587';
$config['smtp_host'] = 'localhost:25';

The 'smtp_port' option was removed in 1.6.0 and you should not change defaults.inc.php. May be the issue is a partially updated config? From the 1.6.0 release notes:

Quote
SMTP:
- renamed smtp_server to smtp_host
- removed smtp_port option (non-standard port can be set via smtp_host)
- set "localhost:587" as a default for smtp_host

Make sure you don't have an old 'smpt_server' option in your config.inc.php instead it should have `$config['smtp_host'] = 'localhost:25';`
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more…

Offline joea

  • Jr. Member
  • **
  • Posts: 15
Re: smtp error(): connection to server failed
« Reply #3 on: November 25, 2023, 04:15:09 PM »
Quote
What I have changed:

/etc/roundcubemail/config.inc.php
//$config['smtp_port'] = 587;
$config['smtp_port'] = 25;

/etc/roundcubemail/defaults.inc.php
//$config['smtp_host'] = 'localhost:587';
$config['smtp_host'] = 'localhost:25';

The 'smtp_port' option was removed in 1.6.0 and you should not change defaults.inc.php. May be the issue is a partially updated config? From the 1.6.0 release notes:

Quote
SMTP:
- renamed smtp_server to smtp_host
- removed smtp_port option (non-standard port can be set via smtp_host)
- set "localhost:587" as a default for smtp_host

Make sure you don't have an old 'smpt_server' option in your config.inc.php instead it should have `$config['smtp_host'] = 'localhost:25';`

That was the problem.  Replaced "smtp_server" with your suggestion and it worked.

I believe this was installed as a vendor supplied package, so, I guess I need to notify them of the issue.

Are those changes documented somewhere?  Wondering if I missed an obvious one here.

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,856
Re: smtp error(): connection to server failed
« Reply #4 on: November 26, 2023, 04:41:54 AM »
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more…