0

全新安装(postfix-dovecote-roundcode)没有保留域名只是 VPS IP 我无法从网络发送任何邮件但我可以从终端正常发送,它返回 SMTP 错误(-1):连接到服务器失败

/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"

会议

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:~# 主机名邮件

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

4

2 回答 2

1

我在配置文件中找到了解决方案

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

它应该是 tls 而不是 ssl :)

于 2018-01-09T19:01:54.213 回答
0

这不应该是:ssl://mail.test.com:587

是这个吗?ssl://localhost:587

我相信roundcube需要将“localhost”设置为邮件服务器地址,但从日志看来,它可能被设置为使用“mail.test.com”

如果 mail.test.com 是您的 VPS - 仅存在于 IP 上,而不存在于 DNS 上 - 则无法使用该地址路由到它,因此同一服务器上的 roundcube 将无法找到它。

如果 roundcube 在同一台服务器上,它使用的邮件服务器地址无论如何都应该设置为“localhost”。

于 2018-01-07T20:50:56.960 回答