Reputation: 479
After site migration to another serwer we have problems with sending emails with PHP via SMTP (some customized PHPMailer). We can send emails to most of addresses but some giva as errors like below. Does anaybody has any suggestions whats wrong? Is it SMTP servers issues or script problem? Shouldn't SMTP return some specyfic errors?
SMTP -> get_lines(): $data was ""
SMTP -> get_lines(): $str is "220 mx.sitte.com.pl ESMTP Exim 4.90_1 Wed, 15 May 2019 12:16:46 +0200 "
SMTP -> get_lines(): $data is "220 mx.sitte.com.pl ESMTP Exim 4.90_1 Wed, 15 May 2019 12:16:46 +0200 "
SMTP -> FROM SERVER:220 mx.sitte.com.pl ESMTP Exim 4.90_1 Wed, 15 May 2019 12:16:46 +0200
SMTP -> get_lines(): $data was ""
SMTP -> get_lines(): $str is "250-mx.sitte.com.pl Hello mx.sitte.com.pl [5.187.55.123] "
SMTP -> get_lines(): $data is "250-mx.sitte.com.pl Hello mx.sitte.com.pl [5.187.55.123] "
SMTP -> get_lines(): $data was "250-mx.sitte.com.pl Hello mx.sitte.com.pl [5.187.55.123] "
SMTP -> get_lines(): $str is "250-SIZE 52428800 "
SMTP -> get_lines(): $data is "250-mx.sitte.com.pl Hello mx.sitte.com.pl [5.187.55.123] 250-SIZE 52428800 "
SMTP -> get_lines(): $data was "250-mx.sitte.com.pl Hello mx.sitte.com.pl [5.187.55.123] 250-SIZE 52428800 "
SMTP -> get_lines(): $str is "250-8BITMIME "
SMTP -> get_lines(): $data is "250-mx.sitte.com.pl Hello mx.sitte.com.pl [5.187.55.123] 250-SIZE 52428800 250-8BITMIME "
SMTP -> get_lines(): $data was "250-mx.sitte.com.pl Hello mx.sitte.com.pl [5.187.55.123] 250-SIZE 52428800 250-8BITMIME "
SMTP -> get_lines(): $str is "250-PIPELINING "
SMTP -> get_lines(): $data is "250-mx.sitte.com.pl Hello mx.sitte.com.pl [5.187.55.123] 250-SIZE 52428800 250-8BITMIME 250-PIPELINING "
SMTP -> get_lines(): $data was "250-mx.sitte.com.pl Hello mx.sitte.com.pl [5.187.55.123] 250-SIZE 52428800 250-8BITMIME 250-PIPELINING "
SMTP -> get_lines(): $str is "250-AUTH PLAIN LOGIN "
SMTP -> get_lines(): $data is "250-mx.sitte.com.pl Hello mx.sitte.com.pl [5.187.55.123] 250-SIZE 52428800 250-8BITMIME 250-PIPELINING 250-AUTH PLAIN LOGIN "
SMTP -> get_lines(): $data was "250-mx.sitte.com.pl Hello mx.sitte.com.pl [5.187.55.123] 250-SIZE 52428800 250-8BITMIME 250-PIPELINING 250-AUTH PLAIN LOGIN "
SMTP -> get_lines(): $str is "250 HELP "
SMTP -> get_lines(): $data is "250-mx.sitte.com.pl Hello mx.sitte.com.pl [5.187.55.123] 250-SIZE 52428800 250-8BITMIME 250-PIPELINING 250-AUTH PLAIN LOGIN 250 HELP "
SMTP -> FROM SERVER: 250-mx.sitte.com.pl Hello mx.sitte.com.pl [5.187.55.123] 250-SIZE 52428800 250-8BITMIME 250-PIPELINING 250-AUTH PLAIN LOGIN 250 HELP
SMTP -> get_lines(): $data was ""
SMTP -> get_lines(): $str is "334 VXNlcm5hbWU6 "
SMTP -> get_lines(): $data is "334 VXNlcm5hbWU6 "
SMTP -> get_lines(): $data was ""
SMTP -> get_lines(): $str is "334 UGFzc3dvcmQ6 "
SMTP -> get_lines(): $data is "334 UGFzc3dvcmQ6 "
SMTP -> get_lines(): $data was ""
SMTP -> get_lines(): $str is "235 Authentication succeeded "
SMTP -> get_lines(): $data is "235 Authentication succeeded "
SMTP -> get_lines(): $data was ""
SMTP -> get_lines(): $str is "250 OK "
SMTP -> get_lines(): $data is "250 OK "
SMTP -> FROM SERVER:250 OK
SMTP -> FROM SERVER:
SMTP -> ERROR: RCPT not accepted from server:
SMTP -> get_lines(): $data was ""
SMTP -> get_lines(): $str is "250 Accepted "
SMTP -> get_lines(): $data is "250 Accepted "
SMTP -> FROM SERVER:250 Accepted
Exim log-s
Succesful email to [email protected]
2019-05-15 12:57:56 1hQrbg-0000gV-9k <= [email protected] H=mx.sitte.com.pl (randki.felcia.co.uk) [5.187.55.123] P=esmtpsa X=TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128 CV=no A=login:felcia S=3991 [email protected] T="Odpowiedź na Twoje ogłoszenie: test test test test test test" from <[email protected]> for [email protected] [email protected]
2019-05-15 12:57:56 cwd=/var/spool/exim 3 args: /usr/sbin/exim -Mc 1hQrbg-0000gV-9k
2019-05-15 12:57:56 1hQrbg-0000gV-9k => felcia <[email protected]> F=<[email protected]> SRS=<[email protected]> R=localuser T=local_delivery S=4134
2019-05-15 12:57:56 1hQrbg-0000gV-9k [91.244.71.100] SSL verify error: depth=0 error=self signed certificate cert=/C=PL/ST=Lubelskie/L=Lublin/O=Futurehost/OU=IT/[email protected]
2019-05-15 12:57:56 1hQrbg-0000gV-9k [91.244.71.100] SSL verify error: certificate name mismatch: DN="/C=PL/ST=Lubelskie/L=Lublin/O=Futurehost/OU=IT/[email protected]" H="mail.sitte.pl"
2019-05-15 12:57:56 login authenticator failed for (User) [103.231.139.176]: 535 Incorrect authentication data ([email protected])
2019-05-15 12:57:56 1hQrbg-0000gV-9k => [email protected] F=<[email protected]> R=lookuphost T=remote_smtp S=4919 H=mail.sitte.pl [91.244.71.100] X=TLSv1:DHE-RSA-AES256-SHA:256 CV=no C="250 OK id=1hQrUm-000DBi-7Q"
2019-05-15 12:57:56 1hQrbg-0000gV-9k Completed
Unsuccessful email to *@o2.pl
2019-05-15 12:59:01 H=mx.sitte.com.pl (randki.felcia.co.uk) [5.187.55.123] incomplete transaction (connection lost) from <[email protected]> for [email protected] [email protected]
2019-05-15 12:59:01 unexpected disconnection while reading SMTP command from mx.sitte.com.pl (randki.felcia.co.uk) [5.187.55.123] D=12s
Upvotes: 0
Views: 682
Reputation: 479
Error was in configuration of SMTP server. Server administrator changed some settings (unfortunately he didn't provide exact solution).
Upvotes: 0
Reputation: 37770
I think you're mixing up two issues here. There are two stages in your delivery - from PHPMailer to your mail server, and from your mail server to the recipient's mail server. From your first debug log, I can see that the first stage appears to be working fine - messages are accepted correctly. The second two examples are from your mail server's log, not PHPMailer output, so they are happening in the second stage.
This means that your problem isn't in PHPMailer nor your script, but in your mail server, or its own network connection. Mail servers come and go, and part of the point of the way SMTP works is to cope with errors, outages, and delays, which is why it's a good idea to use a local mail server with PHPMailer (as you're doing) so that it can deal with issues like this without you worrying about it. This does mean that you should keep an eye on your mail server config and its network connection (via the logs), and it's also a good idea to implement a bounce handler, which is not a small task, so that your app can get to hear about delayed errors like these.
The certificate verification failure (I'm not sure why you described that as a success) is likely to be caused by outdated CA certificates; updating your OS packages, or installing a fresh copy of trusted root certificates (read the PHPMailer troubleshooting guide for more on that). The last one just looks like an unreliable mail server - your own mail server should retry the delivery later on - that's what mail servers are for.
Two other minor things: you only need SMTPDebug = 2
for this kind of problem; anything higher is unnecessarily noisy. You're also using an old version of PHPMailer, so upgrade.
Upvotes: 1