Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loop stop #21

Closed
cheluu opened this issue Oct 23, 2016 · 3 comments
Closed

Loop stop #21

cheluu opened this issue Oct 23, 2016 · 3 comments

Comments

@cheluu
Copy link

cheluu commented Oct 23, 2016

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:

[email protected]

debug:

MX records (oviedolinocesar.com): Array
(
    [oviedolinocesar.com] => 0
)

Connecting to oviedolinocesar.com:25

Connected to oviedolinocesar.com:25 successfully

<<<recv: 

No response in expect(): No response in recv

Closing socket to oviedolinocesar.com:25

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!

@zytzagoo
Copy link
Owner

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();.

@cheluu
Copy link
Author

cheluu commented Oct 25, 2016

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}

@Octolus
Copy link

Octolus commented Jul 4, 2022

So what's the solution when you do 1000 emails at once?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants