SMTP错误(-1):与服务器的连接失败|无法发送邮件

时间:2018-01-07 15:31:10

标签: postfix dovecot roundcube debian-7.6.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"

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 邮件

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

2 个答案:

答案 0 :(得分:1)

我在配置文件

上找到了解决方案

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

应该不是ssl:)

答案 1 :(得分:0)

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

是吗? SSL://本地主机:587

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

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

如果roundcube位于同一台服务器上,那么它使用的邮件服务器地址应该设置为“localhost”。