Closed cheluu closed 8 years ago
Hi,
It's hard to say exactly without the specific line number in the unhandled exception error (if you're running the latest 'master' version at all).
As the comment here says: https://github.com/zytzagoo/smtp-validate-email/blob/master/smtp-validate-email.php#L704
// no response in expect() probably means that the
// remote server forcibly closed the connection...
From the debug output it seems you didn't even get to the HELO/EHLO part after connecting, which is usually a sign that the server in question doesn't really want to talk to you (for whatever reason).
In your example case there are no actual MX records for the domain, but the class still tries the "default" (RFC 2821). So it tries connecting to port 25 there and succeeds, and the server responding on that port doesn't want to play the whole SMTP dance with you.
Generally, one way you could avoid the fatal error is to handle the exception yourself at some point using a try/catch block. Either somewhere in the class itself (and then set that email to false), or just around the parts of code where you're calling $validator->validate();
.
Thank you so much !! @zytzagoo
It's works perfectly with a simple try/catch in $validator->validate(); !
Here's the catch:
exception 'SMTP_Validate_Email_Exception_No_Connection' with message 'No connection' in /home/admin/web/XXXX/public_html/mail/smtp-validate-email.php:632 Stack trace: #0 /home/admin/web/XXXX/public_html/mail/smtp-validate-email.php(498): SMTP_Validate_Email->send('EHLO XXXX.com...') #1 /home/admin/web/XXXX/public_html/mail/smtp-validate-email.php(466): SMTP_Validate_Email->ehlo() #2 /home/admin/web/XXXX.com/public_html/mail/smtp-validate-email.php(284): SMTP_Validate_Email->helo() #3 /home/admin/web/XXXX/public_html/mail/index.php(201): SMTP_Validate_Email->validate() #4 {main}
So what's the solution when you do 1000 emails at once?
Hi! Thank for the script and apologize me for my bad english.
Its works perfect but in some mails its stuck and stops the loop
email:
publicidad@oviedolinocesar.com
debug:
and php error log:
[Sun Oct 23 11:26:18.922931 2016] [:error] [pid 2576] [client ip:65433] PHP Fatal error: Uncaught exception 'SMTP_Validate_Email_Exception_No_Connection' with message 'No connection' in /home/admin/web/XXXX/public_htm$
If you know whats happening I'll be very grateful !
My ip is clean and green light on spamhaus
If you test it and it's works fine for you, there is a way to force that mail to false and dont stop the script/loop? thx!