Author Topic: SMTP Error: Connection failed: (Code: -1)  (Read 2912 times)

Offline xuo

  • Jr. Member
  • **
  • Posts: 23
SMTP Error: Connection failed: (Code: -1)
« on: August 14, 2022, 10:36:30 AM »
Hi,

I"ve just installed the version 1.6 of RC and I can't send any email.
Using RC 1.5 was working fine :
Here is my (working) RC 1.5 config :

Code: [Select]
config.inc.php:$config['smtp_server'] = 'ssl://smtp.%z';
config.inc.php:$config['smtp_port'] = 465;

defaults.inc.php:$config['smtp_log'] = true;
defaults.inc.php:$config['smtp_debug'] = false;
defaults.inc.php:$config['smtp_server'] = 'localhost';
defaults.inc.php:$config['smtp_port'] = 587;
defaults.inc.php:$config['smtp_user'] = '%u';
defaults.inc.php:$config['smtp_pass'] = '%p';
defaults.inc.php:$config['smtp_auth_type'] = null;
defaults.inc.php:$config['smtp_auth_cid'] = null;
defaults.inc.php:$config['smtp_auth_pw'] = null;
defaults.inc.php:$config['smtp_xclient_login'] = false;
defaults.inc.php:$config['smtp_xclient_addr'] = false;
defaults.inc.php:$config['smtp_helo_host'] = '';
defaults.inc.php:$config['smtp_timeout'] = 0;
defaults.inc.php:$config['smtp_conn_options'] = null;

Here is my RC 1.6 config :
Code: [Select]
config.inc.php:$config['smtp_log'] = false;
config.inc.php:$config['smtp_host'] = 'smtp.free.fr:465';
config.inc.php:// $config['smtp_host'] = 'ssl://smtp.%z:465';

defaults.inc.php:$config['smtp_log'] = true;
defaults.inc.php:$config['smtp_debug'] = true;
defaults.inc.php:$config['smtp_host'] = 'localhost:587';
defaults.inc.php:$config['smtp_user'] = '%u';
defaults.inc.php:$config['smtp_pass'] = '%p';
defaults.inc.php:$config['smtp_auth_type'] = null;
defaults.inc.php:$config['smtp_auth_cid'] = null;
defaults.inc.php:$config['smtp_auth_pw'] = null;
defaults.inc.php:$config['smtp_xclient_login'] = false;
defaults.inc.php:$config['smtp_xclient_addr'] = false;
defaults.inc.php:$config['smtp_helo_host'] = '';
defaults.inc.php:$config['smtp_timeout'] = 0;
defaults.inc.php:$config['smtp_conn_options'] = null;

In the log file (errors.log), I get :
[14-Aug-2022 14:12:43 +0000]: <oe3rr98j> PHP Error: Invalid response code received from server (POST /?_task=mail&_unlock=loading1660486014668&_framed=1&_action=send)
[14-Aug-2022 14:12:43 +0000]: <oe3rr98j> SMTP Error: Connection failed:  (Code: -1) in /usr/share/roundcubemail-1.6.0/program/lib/Roundcube/rcube.php on line 1795 (POST /?_task=mail&_unlock=loading1660486014668&_framed=1&_action=send)

The file smtp.log contains :
Code: [Select]
[14-Aug-2022 14:07:43 +0000]: <oe3rr98j> Connecting to tls://smtp.free.fr:465...

I don't know if postfix is used by RC or not but it is working as I can send emails (and I didn't make any changes in its configuration).
I'm using the ident-switch  plugin.

Could you help me to solve this issue ?

Regards.

Xuo.

« Last Edit: August 14, 2022, 10:43:41 AM by xuo »

Offline alec

  • Hero Member
  • *****
  • Posts: 1,363
Re: SMTP Error: Connection failed: (Code: -1)
« Reply #1 on: August 15, 2022, 01:59:12 AM »
$config['smtp_host'] = 'ssl://smtp.%z:465';

should work, but make sure the option is only once in the file.

Offline xuo

  • Jr. Member
  • **
  • Posts: 23
Re: SMTP Error: Connection failed: (Code: -1)
« Reply #2 on: August 15, 2022, 08:24:54 AM »
Hello,

Thank you for the answer. I'd already tried this but without success.
The other identities I use through ident_switch work. The smtp username/password is defined in the ident_swith parameters.
But it is my main identity which does not work. The one NOT defined in ident_switch.
I'll try to disable this plugin to see if it changes anything.

Regards.

Xuo.

Offline xuo

  • Jr. Member
  • **
  • Posts: 23
Re: SMTP Error: Connection failed: (Code: -1)
« Reply #3 on: August 15, 2022, 08:30:07 AM »
Hi,

something I have forgotten to show :
Works : [15-Aug-2022 12:03:43 +0000]: <idil8hib> Connecting to ssl://mail.gandi.net:465...

Does not work : [15-Aug-2022 12:15:08 +0000]: <d4fc30en> Connecting to tls://smtp.free.fr:465...

Why does it indicates tls instead of ssl ? Could the issue come from that ?

Regards.

Xuo.

Offline xuo

  • Jr. Member
  • **
  • Posts: 23
Re: SMTP Error: Connection failed: (Code: -1)
« Reply #4 on: August 15, 2022, 09:28:25 AM »
Hi,

I could make it work after I've added on line 100 of /usr/share/roundcubemail-1.6.0/program/lib/Roundcube/rcube_smtp.php :
$scheme = 'ssl' ;
The $schema variable was previously set to tls and I don't know why (is the PHP parse_url function wrong (I don't think so) or has it been overwritten by some plugin/vendor routine ???).

After that change, I don't see any problem but I need to run more tests.

Xuo.