问题
I'm having enormous difficulty getting mandrill SMTP to send reliably. Or more accurately, authenticate every time. When it does authenticate the email works fine
I can run the send script fine, then 2 or 3 times in succession one after the other. Then it doesn't authenticate. But on occasions it doesn't authenticate straight away.
I thought perhaps it's just because it thinks I'm abusing it and blocked me for a short period.
But I can see that since I started using mandrill SMTP for my website, its failure rate to authenticate is regular.
Tried SPF and dmik text attributed on the domain. This didn't help
Looking around I can't see other people having this issue, but at this rate I certainly can't use mandrill for SMTP.
Can anyone suggest reasons why this could be happening? My credentials are 100% accurate, and I don't think I'm sending many emails at all.
Having the same problem on another server using another mandrill account.
Note: I'm using phpmailer
Example debug error:
2014-12-06 08:52:59 Connection: opening to smtp.mandrillapp.com:587, t=300, opt=array (
)
2014-12-06 08:52:59 Connection: opened
2014-12-06 08:52:59 SERVER -> CLIENT: 220 smtp.mandrillapp.com ESMTP
2014-12-06 08:52:59 CLIENT -> SERVER: EHLO fakemail.com
2014-12-06 08:52:59 SERVER -> CLIENT: 250-ip-10-243-6-11
250-PIPELINING
250-SIZE 26214400
250-STARTTLS
250-AUTH PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250 8BITMIME
2014-12-06 08:52:59 CLIENT -> SERVER: AUTH LOGIN
2014-12-06 08:52:59 SERVER -> CLIENT: 334 VXNlcm5hbWU6
2014-12-06 08:52:59 CLIENT -> SERVER: bWVAZG91Z25vcmZvbGsuY29tLmF1
2014-12-06 08:52:59 SERVER -> CLIENT: 334 UGFzc3dvcmQ6
2014-12-06 08:52:59 CLIENT -> SERVER: REDACTED
2014-12-06 08:53:01 SERVER -> CLIENT: 435 4.7.8 Error: authentication failed: UGFzc3dvcmQ6
2014-12-06 08:53:01 SMTP ERROR: Password command failed: 435 4.7.8 Error: authentication failed: UGFzc3dvcmQ6
2014-12-06 08:53:01 CLIENT -> SERVER: QUIT
2014-12-06 08:53:01 SERVER -> CLIENT: 221 2.0.0 Bye
2014-12-06 08:53:01 Connection: closed
2014-12-06 08:53:01 SMTP connect() failed.
Mailer Error: SMTP connect() failed.
Example correct send:
2014-12-06 08:52:33 Connection: opening to smtp.mandrillapp.com:587, t=300, opt=array (
)
2014-12-06 08:52:33 Connection: opened
2014-12-06 08:52:33 SERVER -> CLIENT: 220 smtp.mandrillapp.com ESMTP
2014-12-06 08:52:33 CLIENT -> SERVER: EHLO fakemail.com
2014-12-06 08:52:33 SERVER -> CLIENT: 250-ip-10-250-28-124
250-PIPELINING
250-SIZE 26214400
250-STARTTLS
250-AUTH PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250 8BITMIME
2014-12-06 08:52:33 CLIENT -> SERVER: AUTH LOGIN
2014-12-06 08:52:33 SERVER -> CLIENT: 334 VXNlcm5hbWU6
2014-12-06 08:52:33 CLIENT -> SERVER: bWVAZG91Z25vcmZvbGsuY29tLmF1
2014-12-06 08:52:33 SERVER -> CLIENT: 334 UGFzc3dvcmQ6
2014-12-06 08:52:33 CLIENT -> SERVER: REDACTED
2014-12-06 08:52:33 SERVER -> CLIENT: 235 2.7.0 Authentication successful
2014-12-06 08:52:33 CLIENT -> SERVER: MAIL FROM:<me@fakemail.com>
2014-12-06 08:52:33 SERVER -> CLIENT: 250 2.1.0 Ok
2014-12-06 08:52:33 CLIENT -> SERVER: RCPT TO:<me@fakemail.com>
2014-12-06 08:52:33 SERVER -> CLIENT: 250 2.1.5 Ok
2014-12-06 08:52:33 CLIENT -> SERVER: DATA
2014-12-06 08:52:33 SERVER -> CLIENT: 354 End data with <CR><LF>.<CR><LF>
2014-12-06 08:52:33 CLIENT -> SERVER: Date: Sat, 6 Dec 2014 19:52:33 +1100
2014-12-06 08:52:33 CLIENT -> SERVER: To: Test <me@fakemail.com>
2014-12-06 08:52:33 CLIENT -> SERVER: From: Test <me@fakemail.com>
2014-12-06 08:52:33 CLIENT -> SERVER: Subject: Here is the subject
2014-12-06 08:52:33 CLIENT -> SERVER: Message-ID: <0a8f3c40575be98668d8ea6fb03f4bfc@fakemail.com>
2014-12-06 08:52:33 CLIENT -> SERVER: X-Priority: 3
2014-12-06 08:52:33 CLIENT -> SERVER: X-Mailer: PHPMailer 5.2.9 (https://github.com/PHPMailer/PHPMailer/)
2014-12-06 08:52:33 CLIENT -> SERVER: MIME-Version: 1.0
2014-12-06 08:52:33 CLIENT -> SERVER: Content-Type: multipart/alternative;
2014-12-06 08:52:33 CLIENT -> SERVER: boundary="b1_0a8f3c40575be98668d8ea6fb03f4bfc"
2014-12-06 08:52:33 CLIENT -> SERVER: Content-Transfer-Encoding: 8bit
2014-12-06 08:52:33 CLIENT -> SERVER:
2014-12-06 08:52:33 CLIENT -> SERVER: --b1_0a8f3c40575be98668d8ea6fb03f4bfc
2014-12-06 08:52:33 CLIENT -> SERVER: Content-Type: text/plain; charset=us-ascii
2014-12-06 08:52:33 CLIENT -> SERVER:
2014-12-06 08:52:33 CLIENT -> SERVER: This is the body in plain text for non-HTML mail clients
2014-12-06 08:52:33 CLIENT -> SERVER:
2014-12-06 08:52:33 CLIENT -> SERVER:
2014-12-06 08:52:33 CLIENT -> SERVER: --b1_0a8f3c40575be98668d8ea6fb03f4bfc
2014-12-06 08:52:33 CLIENT -> SERVER: Content-Type: text/html; charset=us-ascii
2014-12-06 08:52:33 CLIENT -> SERVER:
2014-12-06 08:52:33 CLIENT -> SERVER: This is the HTML message body <strong>in bold!</strong>
2014-12-06 08:52:33 CLIENT -> SERVER:
2014-12-06 08:52:33 CLIENT -> SERVER:
2014-12-06 08:52:33 CLIENT -> SERVER:
2014-12-06 08:52:33 CLIENT -> SERVER: --b1_0a8f3c40575be98668d8ea6fb03f4bfc--
2014-12-06 08:52:33 CLIENT -> SERVER:
2014-12-06 08:52:33 CLIENT -> SERVER: .
2014-12-06 08:52:33 SERVER -> CLIENT: 250 2.0.0 Ok: queued as 109BC180070
2014-12-06 08:52:33 CLIENT -> SERVER: QUIT
2014-12-06 08:52:33 SERVER -> CLIENT: 221 2.0.0 Bye
2014-12-06 08:52:33 Connection: closed
Message sent!
I tried firing the email every 5 seconds. 3 out of 10 times it didn't send.
1 minute later, i tried every 10 seconds. 8 out of 10 didn't send.
回答1:
Since it's intermittent, it certainly looks like a problem at their end. Set SMTPDebug = 3
to see the whole SMTP conversation.
From the one-sided view you've given, it doesn't look like you're using TLS, and it's common not to allow authentication prior to starting TLS, though I can see that the server is saying it will do it. I'd regard allowing auth without TLS as a security flaw, certainly not something you need to allow.
Also make sure you're using latest PHPMailer (5.2.9+).
来源:https://stackoverflow.com/questions/27326653/mandrill-smtp-failures