Author Topic: SMTP Error (-1): Connection to server failed  (Read 200 times)

Offline jimwright

  • Newbie
  • *
  • Posts: 3
SMTP Error (-1): Connection to server failed
« on: November 17, 2022, 09:59:35 PM »
Hey all, I've run Roundcube here for years, still on version 1.5.2.  I've run into a recent issue that I can't figure out.  When trying to send an email, SMTP Error -1 pops up.  I can read email just fine. I've verified that $config['smtp_port'] = 587 is correctly set and that this port is working on my system.  Dedicated mail clients (iOS, Thunderbird) can send mail correctly.

I've looked in /var/log/maillog, /var/log/dovecot.log, /var/log/messages, none of these show anything at all logged when I attempt to send the email.

System is Rocky Linux 8.7, SELinux is enabled.  I suspect that SELinux 'might' be a factor but can't confirm.  I've found a number of older posts and articles elsewhere on fixing this, but nothing in those was relevant or helpful.  I found a forum post here about nothing being logged for a similar issue with no replies.

I know my version isn't current and I'll definitely be looking to update this but would prefer to fix this issue before moving on so as not to complicate the issue.  Unless it's a known issue with my version...

Any help here would be greatly appreciated.

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,783
    • SKaero - Custom Roundcube development
Re: SMTP Error (-1): Connection to server failed
« Reply #1 on: November 18, 2022, 12:34:38 PM »
Any Roundcube errors would show up in the error log at <RC root>/logs/errors.log You can also enable SMTP debug by adding the following to <RC root>/config/config.inc.php
Code: [Select]
// Log SMTP conversation to <log_dir>/smtp.log or to syslog
$config['smtp_debug'] = false;

Offline jimwright

  • Newbie
  • *
  • Posts: 3
Re: SMTP Error (-1): Connection to server failed
« Reply #2 on: November 18, 2022, 02:38:51 PM »
Any Roundcube errors would show up in the error log at <RC root>/logs/errors.log You can also enable SMTP debug by adding the following to <RC root>/config/config.inc.php
Code: [Select]
// Log SMTP conversation to <log_dir>/smtp.log or to syslog
$config['smtp_debug'] = false;

Code: [Select]
[18-Nov-2022 13:15:59 -0600]: <4370lp90> PHP Error: No route to host (POST /webmail2/?_task=mail&_unlock=loading1668798826098&_framed=1&_lang=en_US&_action=send)
[18-Nov-2022 13:15:59 -0600]: <4370lp90> PHP Error: Failed to connect socket: No route to host (POST /webmail2/?_task=mail&_unlock=loading1668798826098&_framed=1&_lang=en_US&_action=send)
[18-Nov-2022 13:15:59 -0600]: <4370lp90> SMTP Error: Connection failed: Failed to connect socket: No route to host in /var/www/html/webmail2/program/lib/Roundcube/rcube.php on line 1774 (POST /webmail2/?_task=mail&_unlock=loading1668798826098&_framed=1&_lang=en_US&_action=send)

I added the above debug to my config (setting this to true), and had the following logged (domain obfuscated):
Code: [Select]
[18-Nov-2022 13:23:39 -0600]: <4370lp90> Connecting to example.com:587...
[18-Nov-2022 13:23:57 -0600]: <4370lp90> Connecting to example.com:587...

I next did a web based port scan and found that port 587 was in fact showing as being filtered for my IP, and not open as expected.  Everything else here looks good, but I have to wait until tonight before I can double check the firewall settings and see if something there has gone wrong.

This has been very helpful, thanks!

Offline jimwright

  • Newbie
  • *
  • Posts: 3
Re: SMTP Error (-1): Connection to server failed
« Reply #3 on: November 18, 2022, 04:01:28 PM »
Checked the firewall and submission port 587 had been marked closed.  Opened this up and my problem is resolved.  ;)