无法登录到SMTP服务器Postfix / Imap Courier / Plesk

时间:2015-03-16 07:19:31

标签: authentication smtp imap postfix-mta plesk

我在将SMTP连接到电子邮件服务器时遇到问题。

我试图用PHPMailer发送电子邮件,这是我得到的错误:

SMTP -> get_lines(): $data was ""SMTP -> get_lines(): $str is "535 5.7.8 Error: authentication failed: encryption needed to use mechanism
"SMTP -> get_lines(): $data is "535 5.7.8 Error: authentication failed: encryption needed to use mechanism
"SMTP -> ERROR: AUTH not accepted from server: 535 5.7.8 Error: authentication failed: encryption needed to use mechanism
CLIENT -> SMTP: RSET
SMTP -> get_lines(): $data was ""SMTP -> get_lines(): $str is "250 2.0.0 Ok
"SMTP -> get_lines(): $data is "250 2.0.0 Ok
"SMTP -> FROM SERVER:250 2.0.0 Ok
exception 'phpmailerException' with message 'SMTP Error: Could not authenticate.' in C:\Projects\oicrm\protected\components\phpMailer\class.phpmailer

我已经使用其他电子邮件服务器测试过它运行正常,因此服务器配置一定有问题。

服务器正在运行Postfix,Courier Imap和Plesk控制面板。

还安装了fail2ban工具。

几个小时前它运行Dovecot而不是Courier,但是我已经将它删除并安装了Courier,认为这样可以解决它,但没有运气。

我也调整过Postfix master.cf,但没有运气。

我认为问题可能是电子邮件服务器配置错误,也可能是服务器上的ssl / auth问题,或者是某些防火墙导致问题?

尝试通过telnet 25进行连接,并得到了这个:

[root@eldeposit postfix]# telnet mail.oibarcelona.com 25
Trying xxx.xxx.140.235...
Connected to xxx.xxxxxxxxx.com.
Escape character is '^]'.
220 ns334238.ip-xx-xx-xx.eu ESMTP Postfix
EHLO ns334238.ip-xx-xx-xx.eu
250-ns334238.ip-xx-xx-xx.eu
250-PIPELINING
250-SIZE 30720000
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
AUTH LOGIN
503 5.5.1 Error: authentication not enabled

在这里提供我的配置:

[root@ns334238 postfix]# postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases, hash:/var/spool/postfix/plesk/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
disable_vrfy_command = yes
html_directory = no
inet_interfaces = all
inet_protocols = all
mail_owner = postfix
mailbox_size_limit = 0
mailman_destination_recipient_limit = 1
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
message_size_limit = 30720000
mydestination = localhost.$mydomain, localhost, localhost.localdomain
myhostname = ns334238.ip-37-187-140.eu
mynetworks =
newaliases_path = /usr/bin/newaliases.postfix
plesk_virtual_destination_recipient_limit = 1
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES
sample_directory = /usr/share/doc/postfix-2.10.1/samples
sender_dependent_default_transport_maps = hash:/var/spool/postfix/plesk/sdd_transport_maps
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtp_send_xforward_command = yes
smtp_tls_security_level = may
smtp_use_tls = no
smtpd_authorized_xforward_hosts = 127.0.0.0/8 [::1]/128
smtpd_client_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_rbl_client zen.spamhaus.org
smtpd_milters = , inet:127.0.0.1:12768
smtpd_proxy_timeout = 3600s
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noplaintext
smtpd_sender_restrictions = check_sender_access hash:/var/spool/postfix/plesk/blacklists, permit_sasl_authenticated
smtpd_timeout = 3600s
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/pki/ns334238.ip-37-187-140.eu.pem
smtpd_tls_ciphers = medium
smtpd_tls_exclude_ciphers = aNULL
smtpd_tls_key_file = $smtpd_tls_cert_file
smtpd_tls_protocols = SSLv3, TLSv1
smtpd_tls_security_level = may
smtpd_use_tls = yes
transport_maps = , hash:/var/spool/postfix/plesk/transport
unknown_local_recipient_reject_code = 550
virtual_alias_maps = $virtual_maps, hash:/var/spool/postfix/plesk/virtual
virtual_gid_maps = static:31
virtual_mailbox_base = /var/qmail/mailnames
virtual_mailbox_domains = $virtual_mailbox_maps, hash:/var/spool/postfix/plesk/virtual_domains
virtual_mailbox_limit = 0
virtual_mailbox_maps = , hash:/var/spool/postfix/plesk/vmailbox
virtual_transport = plesk_virtual
virtual_uid_maps = static:30
postconf: warning: /etc/postfix/main.cf: unused parameter: tls_ssl_options=NO_COMPRESSION

还有一个:

[root@ns334238 postfix]# postconf -M
smtp       inet  n       -       n       -       -       smtpd
pickup     unix  n       -       n       60      1       pickup
cleanup    unix  n       -       n       -       0       cleanup
qmgr       unix  n       -       n       300     1       qmgr
tlsmgr     unix  -       -       n       1000?   1       tlsmgr
rewrite    unix  -       -       n       -       -       trivial-rewrite
bounce     unix  -       -       n       -       0       bounce
defer      unix  -       -       n       -       0       bounce
trace      unix  -       -       n       -       0       bounce
verify     unix  -       -       n       -       1       verify
flush      unix  n       -       n       1000?   0       flush
proxymap   unix  -       -       n       -       -       proxymap
proxywrite unix  -       -       n       -       1       proxymap
smtp       unix  -       -       n       -       -       smtp
relay      unix  -       -       n       -       -       smtp
showq      unix  n       -       n       -       -       showq
error      unix  -       -       n       -       -       error
retry      unix  -       -       n       -       -       error
discard    unix  -       -       n       -       -       discard
local      unix  -       n       n       -       -       local
virtual    unix  -       n       n       -       -       virtual
lmtp       unix  -       -       n       -       -       lmtp
anvil      unix  -       -       n       -       1       anvil
scache     unix  -       -       n       -       1       scache
plesk_virtual unix -     n       n       -       -       pipe flags=DORhu user=popuser:popuser argv=/usr/lib64/plesk-9.0/postfix-local -f ${sender} -d ${recipient} -p /var/qmail/mailnames
mailman    unix  -       n       n       -       -       pipe flags=R user=mailman:mailman argv=/usr/lib64/plesk-9.0/postfix-mailman ${nexthop} ${user} ${recipient}
pickup     fifo  n       -       n       60      1       pickup
plesk_saslauthd unix y   y       n       -       1       plesk_saslauthd status=5 listen=6 dbpath=/var/spool/postfix/plesk/passwd.db
qmgr       fifo  n       -       n       1       1       qmgr
smtps      inet  n       -       n       -       -       smtpd -o smtpd_tls_wrappermode=yes
submission inet  n       -       n       -       -       smtpd -o smtpd_enforce_tls=no -o smtpd_tls_security_level=may -o smtpd_sasl_auth_enable=yes -o smtpd_client_restrictions=permit_mynetworks,permit_sasl_authenticated,reject -o smtpd_sender_restrictions= -o smtpd_recipient_restrictions=permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination
plesk-example-domainbarcelona.com-XXX.XXX.XXX.XXX- unix - n n - -     smtp -o smtp_bind_address=XXX.XXX.XXX.XXX -o smtp_bind_address6= -o smtp_address_preference=ipv4 -o smtp_helo_name=example-domainbarcelona.com
plesk-example-domaintrend.com-XXX.XXX.XXX.XXX- unix - n n -   -       smtp -o smtp_bind_address=XXX.XXX.XXX.XXX -o smtp_bind_address6= -o smtp_address_preference=ipv4 -o smtp_helo_name=example-domaintrend.com
plesk-example-domaintrend.com-XXX.XXX.XXX.XXX- unix - n n -  -       smtp -o smtp_bind_address=XXX.XXX.XXX.XXX -o smtp_bind_address6= -o smtp_address_preference=ipv4 -o smtp_helo_name=example-domaintrend.com
plesk-example-domainbarcelona.fr-XXX.XXX.XXX.XXX- unix - n n -  -       smtp -o smtp_bind_address=XXX.XXX.XXX.XXX -o smtp_bind_address6= -o smtp_address_preference=ipv4 -o smtp_helo_name=example-domainbarcelona.fr
plesk-example-domainbarcelona.co.uk-XXX.XXX.XXX.XXX- unix - n n - -     smtp -o smtp_bind_address=XXX.XXX.XXX.XXX -o smtp_bind_address6= -o smtp_address_preference=ipv4 -o smtp_helo_name=example-domainbarcelona.co.uk
plesk-example-domainbarcelona.de-XXX.XXX.XXX.XXX- unix - n n - -       smtp -o smtp_bind_address=XXX.XXX.XXX.XXX -o smtp_bind_address6= -o smtp_address_preference=ipv4 -o smtp_helo_name=example-domainbarcelona.de
plesk-example-domainmallorca.com-XXX.XXX.XXX.XXX- unix - n n - -      smtp -o smtp_bind_address=XXX.XXX.XXX.XXX -o smtp_bind_address6= -o smtp_address_preference=ipv4 -o smtp_helo_name=example-domainmallorca.com
plesk-example-domainmgzn.com-XXX.XXX.XXX.XXX- unix - n n -    -       smtp -o smtp_bind_address=XXX.XXX.XXX.XXX -o smtp_bind_address6= -o smtp_address_preference=ipv4 -o smtp_helo_name=example-domainmgzn.com
plesk-example-domainmallorca.com-XXX.XXX.XXX.XXX-2001-41d0-a-4aeb-- unix - n n - - smtp -o smtp_bind_address=XXX.XXX.XXX.XXX -o smtp_bind_address6=2001:41d0:a:4aeb:: -o smtp_address_preference=ipv4 -o smtp_helo_name=example-domainmallorca.com

1 个答案:

答案 0 :(得分:6)

我自己找到了解决方案:

http://kb.sp.parallels.com/en/123719

<强>症状

尝试使用Roundcube发送电子邮件时,会发生错误:

SMTP Error (250): Authentication failed

通过telnet连接时,会显示以下输出:

# telnet domain.tld 25
Trying 91.204.25.4...
Connected to domain.tld.
Escape character is '^]'.
220 domain.tld ESMTP Postfix
helo l
250 domain.tld
auth login
503 5.5.1 Error: authentication not enabled

邮件服务器不返回身份验证机制列表:

# telnet 1.2.3.4 25
Trying 1.2.3.4...
Connected to 1.2.3.4
Escape character is '^]'.
220 host.tld ESMTP Postfix
ehlo parallels.com
250-host.tld
250-PIPELINING
250-SIZE 20480000
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN

<强>原因

Postfix配置错误。

解决

检查/etc/postfix/main.cf上的Postfix配置文件。在以下行中注释,这些行负责阻止纯文本密码并强制通过SSL或TLS进行SMTP连接

#smtpd_sasl_security_options = noplaintext
#smtpd_tls_auth_only = yes