zytzagoo / smtp-validate-email

A PHP library for performing email addresses validation via SMTP
GNU General Public License v3.0
437 stars 155 forks source link

Fatal error: Uncaught exception 'SMTPValidateEmail\Exceptions\NoConnection' with message 'No connection' #36

Closed volgot closed 6 years ago

volgot commented 6 years ago

Caused by (Validate.php):

private function throwIfNotConnected() { if (!$this->connected()) { throw new NoConnectionException('No connection'); } }

Because of en empty class in NoConnection.php:

` class NoConnection extends Exception {

} `

Test e-mail : info(at)falkopingshyresbostader(dot)se

p.s. read this, may help -> http://www.smashcompany.com/technology/object-oriented-programming-is-an-expensive-disaster-which-must-end :)

zytzagoo commented 6 years ago

Thanks, but having an empty class is perfectly fine when one just needs a more specific type to be able to throw, so that your consuming code can react appropriately on specific conditions.

It has nothing to do with why that exception was thrown or why your code didn't decide to catch it.

volgot commented 6 years ago

I didn't had any my code there, I needed just validate about 140 000 my subscriber's emails as soon as possible, and did it in multithread mode (started 10 instances of your script in shell). It took about 24 hours, but worked perfectly, thanks for your work :)

In the beginning, Fatal error: Uncaught exception 'SMTPValidateEmail\Exceptions\NoConnection' came everytime any domain was moved, redirected or parked somewhere, so I just commented //throw new NoConnectionException('No connection'); because I didn't need any message about "why email address dosn't exists" in unix shell while script worked and I was sleeping (to read thousands lines in log later I had no desire too) ;)

stanistolberg commented 4 years ago

I didn't had any my code there, I needed just validate about 140 000 my subscriber's emails as soon as possible, and did it in multithread mode (started 10 instances of your script in shell). It took about 24 hours, but worked perfectly, thanks for your work :)

In the beginning, Fatal error: Uncaught exception 'SMTPValidateEmail\Exceptions\NoConnection' came everytime any domain was moved, redirected or parked somewhere, so I just commented //throw new NoConnectionException('No connection'); because I didn't need any message about "why email address dosn't exists" in unix shell while script worked and I was sleeping (to read thousands lines in log later I had no desire too) ;)

If I comment it out, I get new error: Warning: fwrite(): supplied resource is not a valid stream resource And than again: Uncaught SMTPValidateEmail\Exceptions\SendFailed: Send failed on

Could you pease advise?

stanistolberg commented 4 years ago

Ok I the port was blocked by ISP and I had to use other one