Closed sadortun closed 5 months ago
Hi @zytzagoo, yes, if you check for invalid domains, it might take twice the time, only if :
:25
and on :587
But if the server answer on :25
it should not take longer since only the first port will be checked.
I think it should be fairly easy to allow the checks to be done on multiple ports via configuration
This might be up for discussion again now that 1.0 is modernized.
Some notes (to self if nothing else):
$hosts
array is just filled and then iterated over).Whether the extra complexity is worth it, I'm still not sure really...
Ideally, code implementing this lib can set it's own connect port based on its own grouping of hosts and whatnot, and have separate functions for checking groups of emails that require connections on non-default ports etc.
Hi, sorry for not replying sooner (been swamped), and thanks for the contribution(s).
I like the general idea behind this, but it could be slow(er) for the (most common) existing use cases in the wild (since it's actually now doing two attempts per domain by default).
If this could be made optional (turned on via public setter or some such), then I'd be wiling to merge it in.
Without going all OOP-y on it (with a bunch of setters and whatnot), we could just check if
$connect_ports
is an array, and if so, do the dance you're doing in the PR, but if not, use the old way. Then calling code could just set$validator->connect_ports = [25, 587];
before callingvalidate()
?Ideally, the whole while/foreach
$hosts
building thingy would be placed in a separate method...What are your thoughts on this?
If you're not up for doing it this way, I'll probably do it anyway (as soon as I get some spare time on my hands). If it turns out that there's an actual need for this from other users, that might speed things up a bit, but no promises :)