Author Topic: can't connect to the mail server...  (Read 10033 times)

Offline tommyjp

  • Newbie
  • *
  • Posts: 3
can't connect to the mail server...
« on: September 11, 2016, 02:31:37 AM »
Hello,

I am installing Roundcube with roundcubemail-1.2.1-complete.tar.gz.
But Test SMTP config on Roundcube Webmail Installer says like this:

Quote
Trying to send email...
SMTP send:  NOT OK(Connection failed: Failed to connect socket: fsockopen(): unable to connect to ssl://mail.mydomain.com:465 (Unknown error))

And also Test IMAP config says like this:

Quote
Connecting to ssl://mail.mydomain.com...
IMAP connect:  NOT OK(Login failed for user from fedc:ba98:7654:1:3:2:1:0. Could not connect to ssl://mail.mydomain.com:993: Unknown reason)

I can send and receive mails by Windows Live Mail and K-9 Mail for Android.
Actually mail server and web server is the same server. Looks like connection from the same server is unavailable although connection from outside is available.However I can connect to my mail server from web server by telnet as follows.

Quote
root@myhost:~# telnet mail.mydomain.com 993
Trying 1234:5678:9abc:def::1234:5678...
Connected to myhost.
Escape character is '^]'.
^]
telnet> quit
Connection closed.
root@myhost:~# telnet mail.mydomain.com 465
Trying 1234:5678:9abc:def::1234:5678...
Connected to myhost.
Escape character is '^]'.
^]
telnet> quit
Connection closed.
root@myhost:~#

I tried "iptables -F" but the result was the same.

Quote
OS: Ubuntu 16.04 / Linux 2.6.32 64bit
Web server: Apache/2.4.18
Mail server: Dovecot 2.2.22, Postfix 3.1.0
IMAP hostname/port: mail.mydomain.com 993 (SSL)
SMTP hostname/port: mail.mydomain.com 465 (SSL)

Anyone can help me?
Thank you.

Yusui Tomikawa

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,876
    • SKaero - Custom Roundcube development
Re: can't connect to the mail server...
« Reply #1 on: September 12, 2016, 03:12:02 PM »
Since its on the same server try localhost instead of mail.mydomain.com.

Offline tommyjp

  • Newbie
  • *
  • Posts: 3
Re: can't connect to the mail server...
« Reply #2 on: September 13, 2016, 09:53:39 AM »
Thank you for the reply.

I tried it but localhost has the same result as follows.

Test SMTP config says:
Quote
Trying to send email...
SMTP send:  NOT OK(Connection failed: Failed to connect socket: fsockopen(): unable to connect to ssl://localhost:465 (Unknown error))

Test IMAP config says:
Quote
Connecting to ssl://localhost...
IMAP connect:  NOT OK(Login failed for user from fedc:ba98:7654:1:3:2:1:0. Could not connect to ssl://localhost:993: Unknown reason)

Offline tommyjp

  • Newbie
  • *
  • Posts: 3
Re: can't connect to the mail server...
« Reply #3 on: September 15, 2016, 11:06:25 AM »
Here is additional information I forgot to say.

PHP version: 7.0.8
mysql version: 14.14 Distrib 5.7.13

/var/log/syslog says like this:

SMTP:
Sep 15 14:48:34 host postfix/smtps/smtpd[506]: connect from localhost[::1]
Sep 15 14:48:34 host postfix/smtps/smtpd[506]: SSL_accept error from localhost[::1]: 0
Sep 15 14:48:34 host postfix/smtps/smtpd[506]: warning: TLS library problem: error:14094418:SSL routines:ssl3_read_bytes:tlsv1 alert unknown ca:s3_pkt.c:1472:SSL alert number 48:
Sep 15 14:48:34 host postfix/smtps/smtpd[506]: lost connection after CONNECT from localhost[::1]
Sep 15 14:48:34 host postfix/smtps/smtpd[506]: disconnect from localhost[::1] commands=0/0

IMAP:
Sep 15 14:50:09 host dovecot: imap-login: Error: SSL: Stacked error: error:14094418:SSL routines:ssl3_read_bytes:tlsv1 alert unknown ca: SSL alert number 48
Sep 15 14:50:09 host dovecot: imap-login: Disconnected (no auth attempts in 0 secs): user=<>, rip=::1, lip=::1, TLS handshaking: SSL_accept() failed: Unknown error, session=<mM1Y9ow8rtwAAAAAAAAAAAAAAAAAAAAB>


logs/errors says:

SMTP:
[15-Sep-2016 14:58:31 UTC] ERROR: fsockopen(): unable to connect to ssl://localhost:465 (Unknown error) (0)
[15-Sep-2016 14:58:31 UTC] ERROR: Failed to connect socket: fsockopen(): unable to connect to ssl://localhost:465 (Unknown error) ()

IMAP:
nothing

I get no idea why it can't connect....

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,876
    • SKaero - Custom Roundcube development
Re: can't connect to the mail server...
« Reply #4 on: September 15, 2016, 03:55:18 PM »
So that defiantly looks like an SSL error, you may want to try setting the following settings.
Code: [Select]
// IMAP socket context options
// See http://php.net/manual/en/context.ssl.php
// The example below enables server certificate validation
//$config['imap_conn_options'] = array(
//  'ssl'         => array(
//     'verify_peer'  => true,
//     'verify_depth' => 3,
//     'cafile'       => '/etc/openssl/certs/ca.crt',
//   ),
// );
$config['imap_conn_options'] = null;

// SMTP socket context options
// See http://php.net/manual/en/context.ssl.php
// The example below enables server certificate validation, and
// requires 'smtp_timeout' to be non zero.
// $config['smtp_conn_options'] = array(
//   'ssl'         => array(
//     'verify_peer'  => true,
//     'verify_depth' => 3,
//     'cafile'       => '/etc/openssl/certs/ca.crt',
//   ),
// );
$config['smtp_conn_options'] = null;