【问题标题】:SMTP Error (-1): Connection to server failed | can't sent mailsSMTP 错误 (-1):与服务器的连接失败 |无法发送邮件
【发布时间】:2018-06-16 17:52:44
【问题描述】:

全新安装(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.test.com test.com

【问题讨论】:

    标签: postfix dovecot roundcube debian-7.6.0


    【解决方案1】:

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

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

    应该是 tls 而不是 ssl :)

    【讨论】:

      【解决方案2】:

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

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

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

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

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

      【讨论】:

      • 是的,它们都在同一台服务器上,是的,我知道它仅适用于发送邮件,但在将其更改为 localhost PHP 消息后在日志上未收到相同的错误:无法连接套接字:fsockopen (): 无法连接到 ssl://localhost:587 (未知错误) ():" 同时从上游读取响应头
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-14
      • 1970-01-01
      • 2014-02-17
      • 2018-01-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多