smtp-validate-email icon indicating copy to clipboard operation
smtp-validate-email copied to clipboard

Timeout doesn't work

Open jgcabral opened this issue 6 years ago • 7 comments

I'm extending class and inside function constructor i set timeout = 250(ms) but i when execute the script delay more time. Often it happen with email address hotmail.

jgcabral avatar Apr 09 '18 22:04 jgcabral

Can you show where/how exactly you're doing that? This class's constructor does not accept timeout as an option by default, so hard to tell what's going on in some custom code of yours...

Are you using setConnectTimeout()? Are we talking about connect timeout at all, or some other timeout? Unit tests show that setting/getting the connect timeout works as expected. Functional test too.

zytzagoo avatar Apr 10 '18 07:04 zytzagoo

The code is the following. $validator = new EmailValidator($email, $sender); $validator->setConnectTimeout(0.25); but when i enter any address hotmail's, delay a lot of time.

jgcabral avatar Apr 10 '18 19:04 jgcabral

Connect timeout must (currently) be specified as integer seconds, not float (https://secure.php.net/stream_set_timeout is used), so that might be one of the reasons why its "not working", but we'll have to define what not working really means in this context...

Do you have some debug logs/timestamps which show that the delay is actually happening at the connect phase?

Could it be that Hotmail is throttling you due to bad/spammy behaviour and/or bad/spammy ip reputation/history?

zytzagoo avatar Apr 11 '18 02:04 zytzagoo

Does setting the connect timeout to 1 (second) help as a workaround? Or does that also have no effect at all?

zytzagoo avatar Apr 11 '18 03:04 zytzagoo

You're right, i think hotmail's servers are generating delay. I have tried setting 1 second but no success. I need to set 250 ms for any email server. I have no logs to show you,

jgcabral avatar Apr 11 '18 18:04 jgcabral

Feature request 1: Maybe being able to set sub-second connectTimeout, but even if implemented, it does not help with server-generated delays/throttling.

Feature request 2: Detecting delays/throttling (and maybe dropping the connection in that case, and it being somewhat configurable)

These are not something I planned on adding myself (no need for it), however, if someone contributes the code and tests for it, I'll more than gladly review and merge.

zytzagoo avatar Apr 14 '18 10:04 zytzagoo

Ok, thanks anyway.

jgcabral avatar Apr 17 '18 20:04 jgcabral