1

Topic: SMTP does not work on remote client

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 0.9.8
- Linux/BSD distribution name and version: Ubuntu 16.04
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL 5.7.22
- Web server (Apache or Nginx):1.14 ubuntu
- Manage mail accounts with iRedAdmin-Pro?
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

Why does SMTP not work on remote client?
In the mail server, Roundcube can send email so well, but when I've tried on other side such thunderbird, PHP code it does not. I open all ports.

I try to change port and protocol and I got different error also.

1. Port: 587, Protocol: STARTTLS
Error: Failed to connect to STARTTLS://bb.aaa.com:587 [SMTP: Failed to connect socket: Unable to find the socket transport "STARTTLS" - did you forget to enable it when you configured PHP? (code: -1, response: )]

2. Port: 587, Protocol: TLS
Error: Failed to connect to tls://bb.aaa.com:587 [SMTP: Failed to connect socket: fsockopen(): unable to connect to tls://bb.aaa.com:587 (Unknown error) (code: -1, response: )]

3. Port: 587, Protocol: SSL
Error: Failed to connect to ssl://bb.aaa.com:587 [SMTP: Failed to connect socket: fsockopen(): unable to connect to ssl://bb.aaa.com:587 (Unknown error) (code: -1, response: )]

4. Port: 465, Protocol: SSL
Error: Failed to connect to ssl://pmail.cotafer.com:465 [SMTP: Failed to connect socket: Connection timed out (code: -1, response: )]

5. Port: 25, Protocol: None
Error: authentication failure [SMTP: STARTTLS failed (code: 220, response: 2.0.0 Ready to start TLS)]

What is wrong friends?

2

Re: SMTP does not work on remote client

- Does it work if you use IP address instead of domain names like 'bb.aa.com', 'pmail.cotafer.com'?
- Do you have correct DNS records for these domain names?

----

Does my reply help a little? How about buying me a cup of coffee ($5) as an encouragement?

buy me a cup of coffee

3

Re: SMTP does not work on remote client

Hi Zhang,
1. I did, but the error still keeps the same.
2. I think, it is correct, I follow the document.

I can send email out and receive so well on the email server.

4

Re: SMTP does not work on remote client

If Roundcube webmail works well and you can send email out with it, that means SMTP and submission services are ok. In this case, sending email with Thunderbird should work fine with setting: port 587 with TLS (or STARTTLS), use server IP address as smtp server address.

If it doesn't work, any error in Postfix log file (/var/log/maillog)?

----

Does my reply help a little? How about buying me a cup of coffee ($5) as an encouragement?

buy me a cup of coffee

5

Re: SMTP does not work on remote client

- case 1:
When I sent out via thunderbird.

Sending of the message failed.
The message could not be sent using Outgoing server (SMTP) bb.aa.com for an unknown reason. Please verify that your Outgoing server (SMTP) settings are correct and try again.

Log: /var/log/maillog
it is always showing connection time out.
Jul 17 06:33:47 bbmail amavis[3302]: Found secondary av scanner clamav-clamscan at /usr/bin/clamscan
Jul 17 09:28:17 bbmail postfix/submission/smtpd[9038]: connect from unknown[xx.x.x.x]
Jul 17 09:28:29 bbmail postfix/submission/smtpd[9045]: connect from unknown[xx.x.x.x]
Jul 17 09:28:33 bbmail postfix/submission/smtpd[9048]: connect from unknown[xx.x.x.x]
Jul 17 09:28:38 bbmail postfix/submission/smtpd[9050]: connect from unknown[xx.x.x.x]
Jul 17 09:28:38 bbmail postfix/submission/smtpd[9051]: connect from unknown[xx.x.x.x]
Jul 17 09:29:42 bbmail postfix/submission/smtpd[9082]: connect from unknown[xx.x.x.x]
Jul 17 09:29:42 bbmail postfix/submission/smtpd[9082]: Anonymous TLS connection established from unknown[163.53.198.170]: TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)
Jul 17 09:29:42 bbmail postfix/submission/smtpd[9082]: warning: TLS library problem: error:14094418:SSL routines:ssl3_read_bytes:tlsv1 alert unknown ca:../ssl/record/rec_layer_s3.c:1399:SSL alert number 48:
Jul 17 09:29:42 bbmail postfix/submission/smtpd[9082]: lost connection after STARTTLS from unknown[xx.x.x.x]
Jul 17 09:29:42 bbmail postfix/submission/smtpd[9082]: disconnect from unknown[163.53.198.170] ehlo=1 starttls=1 commands=2
Jul 17 09:30:15 bbmail postfix/submission/smtpd[9038]: lost connection after CONNECT from unknown[xx.x.x.x]
Jul 17 09:30:15 bbmail postfix/submission/smtpd[9038]: disconnect from unknown[xx.x.x.x] commands=0/0
Jul 17 09:30:21 bbmail postfix/submission/smtpd[9045]: lost connection after CONNECT from unknown[xx.x.x.x]
Jul 17 09:30:21 bbmail postfix/submission/smtpd[9045]: disconnect from unknown[xx.x.x.x] commands=0/0
Jul 17 09:30:24 bbmail postfix/submission/smtpd[9048]: lost connection after CONNECT from unknown[xx.x.x.x]
Jul 17 09:30:24 bbmail postfix/submission/smtpd[9048]: disconnect from unknown[xx.x.x.x] commands=0/0
Jul 17 09:30:28 bbmail postfix/submission/smtpd[9050]: lost connection after CONNECT from unknown[xx.x.x.x]
Jul 17 09:30:28 bbmail postfix/submission/smtpd[9050]: disconnect from unknown[xx.x.x.x] commands=0/0
Jul 17 09:30:28 bbmail postfix/submission/smtpd[9051]: lost connection after CONNECT from unknown[xx.x.x.x]
Jul 17 09:30:28 bbmail postfix/submission/smtpd[9051]: disconnect from unknown[xx.x.x.x] commands=0/0
Jul 17 09:32:22 bbmail postfix/submission/smtpd[9155]: connect from unknown[xx.x.x.x]
Jul 17 09:32:48 bbmail postfix/submission/smtpd[9165]: connect from unknown[xx.x.x.x]
Jul 17 09:32:49 bbmail postfix/submission/smtpd[9165]: Anonymous TLS connection established from unknown[163.53.198.170]: TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)
Jul 17 09:32:49 bbmail postfix/submission/smtpd[9165]: warning: TLS library problem: error:14094418:SSL routines:ssl3_read_bytes:tlsv1 alert unknown ca:../ssl/record/rec_layer_s3.c:1399:SSL alert number 48:
Jul 17 09:32:49 bbmail postfix/submission/smtpd[9165]: lost connection after STARTTLS from unknown[xx.x.x.x]
Jul 17 09:32:49 bbmail postfix/submission/smtpd[9165]: disconnect from unknown[xx.x.x.x] ehlo=1 starttls=1 commands=2
Jul 17 09:34:08 bbmail postfix/submission/smtpd[9155]: lost connection after CONNECT from unknown[xx.x.x.x]
Jul 17 09:34:08 bbmail postfix/submission/smtpd[9155]: disconnect from unknown[xx.x.x.x] commands=0/0
Jul 17 09:28:17 bbmail postfix/submission/smtpd[9038]: connect from unknown[xx.x.x.x]
Jul 17 09:28:29 bbmail postfix/submission/smtpd[9045]: connect from unknown[xx.x.x.x]
Jul 17 09:28:33 bbmail postfix/submission/smtpd[9048]: connect from unknown[xx.x.x.x]
Jul 17 09:28:38 bbmail postfix/submission/smtpd[9050]: connect from unknown[xx.x.x.x]
Jul 17 09:28:38 bbmail postfix/submission/smtpd[9051]: connect from unknown[xx.x.x.x]
Jul 17 09:29:42 bbmail postfix/submission/smtpd[9082]: connect from unknown[xx.x.x.x]
Jul 17 09:29:42 bbmail postfix/submission/smtpd[9082]: Anonymous TLS connection established from unknown[163.53.198.170]: TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)
Jul 17 09:29:42 bbmail postfix/submission/smtpd[9082]: warning: TLS library problem: error:14094418:SSL routines:ssl3_read_bytes:tlsv1 alert unknown ca:../ssl/record/rec_layer_s3.c:1399:SSL alert number 48:
Jul 17 09:29:42 bbmail postfix/submission/smtpd[9082]: lost connection after STARTTLS from unknown[xx.x.x.x]
Jul 17 09:29:42 bbmail postfix/submission/smtpd[9082]: disconnect from unknown[xx.x.x.x] ehlo=1 starttls=1 commands=2
Jul 17 09:30:15 bbmail postfix/submission/smtpd[9038]: lost connection after CONNECT from unknown[xx.x.x.x]
Jul 17 09:30:15 bbmail postfix/submission/smtpd[9038]: disconnect from unknown[xx.x.x.x] commands=0/0

6

Re: SMTP does not work on remote client

- case 2:
I used PHP to send mail
<?php
require_once "Mail.php";
$from = "Test <test@xxx.com>";
$to = "Kun <sitthykun@gmail.com>";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
$host = "tls://x.x.x.x";
$port = "587";
$auth = true;
$username = "test@xxx.com";
$password = "Ujdhy3930s3RtE";
$headers = array ('From' => $from,
  'To' => $to,
  'Subject' => $subject);
$smtp = Mail::factory('smtp',
  array ('host' => $host,
    'port' => $port,
    'auth' => true,
    'username' => $username,
    'password' => $password));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
  echo("<p>" . $mail->getMessage() . "</p>");
} else {
  echo("<p>Message successfully sent!</p>");
}

?>
-----------
output:
Failed to connect to tls://x.x.x.x:587
[SMTP: Failed to connect socket: fsockopen(): unable to connect to
tls://x.x.x.x:587 (Unknown error) (code: -1, response: )]

7

Re: SMTP does not work on remote client

Do you use a self-signed ssl cert? is it possible to request a free LetsEncrypt cert and try again?

----

Does my reply help a little? How about buying me a cup of coffee ($5) as an encouragement?

buy me a cup of coffee

8

Re: SMTP does not work on remote client

ZhangHuangbin wrote:

Do you use a self-signed ssl cert? is it possible to request a free LetsEncrypt cert and try again?

I don't use self-signed ssl cert, because i does not work.
I use Let's Encrypt.

9

Re: SMTP does not work on remote client

sitthykun wrote:

Jul 17 09:28:38 bbmail postfix/submission/smtpd[9050]: connect from unknown[xx.x.x.x]

Is this xx.x.x.x the IP address of your laptop running MUA (Outlook/Thunderbird) for testing?

If MUA successfully connects to Postfix, that means port 587 is reachable in your network, then it should be fine. but according to postfix log, the connection was broken after smtp command 'CONNET'.

Is there any firewall / gateway sits between iRedMail server and your MUA? and it also does some traffic control?

----

Does my reply help a little? How about buying me a cup of coffee ($5) as an encouragement?

buy me a cup of coffee