doumen5491
2017-03-22 16:42 浏览 96
已采纳

Gmail smtp验证不正确

I'm trying to use smtp.gmail to send mail from a php script(swiftMailer and PHPMailer) on my shared host. The reason for this is emails from my host smtp are being blocked by several providers. I am sending low volume to members of a club once per month.
Using wamp locally everything works. From my host this is the response "Expected response code 235 but got code "535", with message "535 Incorrect authentication data " (code: 535)"

Here's the successful local host log:

++ Starting Swift_SmtpTransport << 220 smtp.gmail.com ESMTP t128sm578436oie.10 - gsmtp >> EHLO smtp.gmail.com << 250-smtp.gmail.com at your service, [2600:100b:b01d:4f88:c868:fff1:ec38:5954] 250-SIZE 35882577 250-8BITMIME 250-STARTTLS 250-ENHANCEDSTATUSCODES 250-PIPELINING 250-CHUNKING 250 SMTPUTF8 >> STARTTLS << 220 2.0.0 Ready to start TLS >> EHLO smtp.gmail.com << 250-smtp.gmail.com at your service, [2600:100b:b01d:4f88:c868:fff1:ec38:5954] 250-SIZE 35882577 250-8BITMIME 250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH 250-ENHANCEDSTATUSCODES 250-PIPELINING 250-CHUNKING 250 SMTPUTF8 >> AUTH LOGIN << 334 VXNlcm5hbWU6 >> xxx << 334 UGFzc3dvcmQ6 >> xxx== << 235 2.7.0 Accepted

Here's the failed host log:

++ Starting Swift_SmtpTransport << 220-omniark.omniark.com ESMTP Exim 4.87 #1 Wed, 22 Mar 2017 09:31:09 -0500 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail. >> EHLO smtp.gmail.com << 250-omniark.omniark.com Hello omniark.omniark.com [50.22.8.114] 250-SIZE 52428800 250-8BITMIME 250-PIPELINING 250-AUTH PLAIN LOGIN 250-STARTTLS 250 HELP >> STARTTLS << 220 TLS go ahead >> EHLO smtp.gmail.com << 250-omniark.omniark.com Hello omniark.omniark.com [50.22.8.114] 250-SIZE 52428800 250-8BITMIME 250-PIPELINING 250-AUTH PLAIN LOGIN 250 HELP >> AUTH LOGIN << 334 VXNlcm5hbWU6 >> xxx << 334 UGFzc3dvcmQ6 >> xxx== << 535 Incorrect authentication data !! Expected response code 235 but got code "535", with message "535 Incorrect authentication data " (code: 535)

Searching some more I came across this:

Incorrect Authentication Data can result when mailbox permissions are changed due to migrations, or an account/server update. This can be quickly fixed by running the /scripts/mailperm from terminal, or by going to WHM > Email > Repair Mailbox permissions.

Since i don't have WHM access I would appreciate some guidance on this issue from someone with the know how that I don't posses.

Thank you for your attention in advance.

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答 默认 最新

  • 已采纳
    doupiao9318 doupiao9318 2017-03-22 17:18

    Look at the output from that second session. The first thing the server says is that it is omniark.omniark.com, not smtp.gmail.com. This means that your connection is being intercepted and redirected to your ISP's mail server, where, of course, your gmail credentials will not work.

    Before you get that far, you should have had a certificate validation failure because the host name does not match the certificate name. If this was allowed to happen, you need to fix your config to always verify certificates as otherwise you are effectively the victim of an MITM attack and have given away your credentials.

    In short, your ISP is blocking your outbound connection. While I can see you're using SwiftMailer, this is covered in PHPMailer's troubleshooting guide.

    I edited out your ID and password from the SMTP transcripts; you should change your password now.

    点赞 评论 复制链接分享

相关推荐