0

Fresh installation (postfix-dovecote-roundcode) without reserving domain name just VPS IP i can't sent any mail from web but i can sent normally from terminal, it'r return SMTP Error (-1): Connection to server failed

/var/log/mail.log

Jan  7 05:28:04 mail postfix/submission/smtpd[9541]: connect from localhost[127.0.0.1]
Jan  7 05:28:04 mail postfix/submission/smtpd[9541]: lost connection after UNKNOWN from localhost[127.0.0.1]
Jan  7 05:28:04 mail postfix/submission/smtpd[9541]: disconnect from localhost[127.0.0.1]
Jan  7 05:33:06 mail postfix/submission/smtpd[9607]: connect from localhost[127.0.0.1]
Jan  7 05:33:06 mail postfix/submission/smtpd[9607]: lost connection after UNKNOWN from localhost[127.0.0.1]
Jan  7 05:33:06 mail postfix/submission/smtpd[9607]: disconnect from localhost[127.0.0.1]

/var/log/nginx/error.log

2018/01/07 05:33:06 [error] 9504#0: *1 FastCGI sent in stderr: "PHP message: fsockopen(): unable to connect to ssl://mail.test.com:587 (Unknown error) (0): 
PHP message: Failed to connect socket: fsockopen(): unable to connect to ssl://mail.test.com:587 (Unknown error) ():" while reading response header from upstream, client: 16.196.246.136, server: , request: "POST /rcm/?_task=mail&_unlock=loading1515303186377&_lang=en&_framed=1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "", referrer: "https://X.x.x.x/rcm/?_task=mail&_id=5005492295a51afd366fe3&_action=compose"

Conf

root@mail:~# postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
inet_interfaces = all
mailbox_size_limit = 0
mydestination = localhost
myhostname = mail.test.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_tls_security_level = may
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = private/auth
smtpd_sasl_type = dovecot
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/dovecot/dovecot.pem
smtpd_tls_key_file = /etc/dovecot/private/dovecot.pem
smtpd_tls_security_level = may
smtpd_use_tls = yes
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf mysql:/etc/postfix/mysql-virtual-email2email.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
virtual_transport = lmtp:unix:private/dovecot-lmtp

10-master.conf

root@mail:~# grep -v "#" /etc/dovecot/conf.d/10-master.conf
service imap-login {
  inet_listener imap {
    port = 0
  }
  inet_listener imaps {
    port = 993
    ssl = yes
  }
}
service pop3-login {
  inet_listener pop3 {
    port = 0
  }
  inet_listener pop3s {
    port = 995
    ssl = yes
  }
}
service lmtp {
  unix_listener /var/spool/postfix/private/dovecot-lmtp {
    mode = 0600
    user = postfix
    group = postfix
  }
}
service imap {
}
service pop3 {
}
service auth {
  unix_listener /var/spool/postfix/private/auth {
    mode = 0600
    user = postfix 
    group = postfix
  }
  unix_listener auth-userdb {
    mode = 0600
    user = vmail
  }
 user = dovecot
}
service auth-worker {
  user = vmail
}
service dict {
  unix_listener dict {
  }
}

root@mail:~# hostname mail

root@mail:~# cat /etc/hosts 127.0.0.1 localhost mail mail.test.com test.com

2 Answers2

2

i found the solution it's on the configuration file

$config['smtp_server'] = 'tls://mail.com'

it should be tls not ssl :)

0

Shouldn't this: ssl://mail.test.com:587

be this? ssl://localhost:587

I believe roundcube needs "localhost" set as the mailserver address, but from the logs it looks to me like it might be set to use "mail.test.com"

If mail.test.com is your VPS - that only exists on IP, not DNS - then there is no way to route to it using that address, so roundcube on the same server will not be able to find it.

If roundcube is on the same server, the mailserver address it uses should be set to "localhost" anyway.

  • Yes all of them on the same server, and yes i know it will work only for sending mails not receiving still the same erro on log after change it to localhost PHP message: Failed to connect socket: fsockopen(): unable to connect to ssl://localhost:587 (Unknown error) ():" while reading response header from upstream – Mohamed Ibrahim Jan 08 '18 at 12:13