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

All address at the same domain becomes invalid if the server responds with 421 4.7.0 Error: too many errors #60

Open
orionstar opened this issue Dec 18, 2020 · 5 comments

Comments

@orionstar
Copy link

orionstar commented Dec 18, 2020

I'm doing batch validations for my mail lists (ten thousends addresses) . A few email provider gives me error like below with varying account status (inactive, deleted, blocked etc):
550 5.1.1 <PLACEHOLDER@freemail.hu>: Recipient address rejected: u'SMTP service is disabled for this account. AccountId: 12345678. Reason: The account is INACTIVE'
Unexpected response to RCPT TO: 550 5.1.1 <PLACEHOLDER@freemail.hu>: Recipient address rejected: u'SMTP service is disabled for this account. AccountId: 12345678. Reason: The account is INACTIVE'
(I've changed the mailbox name to placeholder)

After errors like this all address at the same domain becomes invalid even if I got back 250 2.1.5 Ok for the most of them.

This problem only occurs if I'm validating large batches. If I only validate 50 or so the issue doesn't occur.

@zytzagoo
Copy link
Owner

Ok, so what does the code on php side look like for that?
Especially the part which is (supposedly?) using this library?

@orionstar
Copy link
Author

orionstar commented Dec 18, 2020

I'm basically using the sample code without customization:
$validator = new SmtpEmailValidator($emails, $sender); $results = $validator->validate();

The $emails array contains 20 to 50 thousands of addresses when I'm facing the issue, the $sender is my company's email address. When I started to debug then I enabled the debug property by setting it true.

@zytzagoo
Copy link
Owner

Could be related to "catch-all" and/or no_comm_is_valid settings/handling ? (see catchall_is_valid property: https://github.com/zytzagoo/smtp-validate-email/blob/master/src/Validator.php#L41) and the logic inside performSmtpDance() (https://github.com/zytzagoo/smtp-validate-email/blob/master/src/Validator.php#L391)

Could you maybe produce a reduced example that reproduces the issue reliably?
(amount of emails should not matter as such, same bug should be reproducible with 2-3 recipients on the same domain)

@b4nghh
Copy link

b4nghh commented Dec 20, 2020

A bit off topic. How many emails should we validate at the same time?

@orionstar
Copy link
Author

Now I had time to dig deeper. The last error is always 421 4.7.0 mx.onbox.hu Error: too many errors. If I have 20 failed address then this response triggered by some of the hosts and after that Validator.php::802 expect() throws UnexpectedResponseException beacuse of the error code (421) then its catched in line 360 and it sets all address as invalid inspite of previous successfull checks. I assume the expect() method should be refactored by throwing a new ReconnectNeededException if it encounters with 421 4.7.0 then it should be catched in the address foreach (line 342) and reconnect if it happens.

Example set:
$addresses = [ 'asd123456781@freemail.hu', 'asd123456782@freemail.hu', 'asd123456783@freemail.hu', 'asd123456784@freemail.hu', 'asd123456785@freemail.hu', 'asd123456786@freemail.hu', 'asd123456787@freemail.hu', 'asd123456788@freemail.hu', 'asd123456789@freemail.hu', 'asd1234567810@freemail.hu', 'asd1234567811@freemail.hu', 'asd1234567812@freemail.hu', 'asd1234567813@freemail.hu', 'asd1234567814@freemail.hu', 'asd1234567815@freemail.hu', 'info@freemail.hu', 'asd123456712@freemail.hu', 'asd123456722@freemail.hu', 'asd123456732@freemail.hu', 'asd123456742@freemail.hu', 'asd123456752@freemail.hu', ];

If you delete one of the made up mail address then the validation will work correctly.

In my case I limited my batches to max 20 addresses at these providers as a hotfix.

Thank you for your assistance. Merry Xmas! ;)

@orionstar orionstar changed the title All address at the same domain becomes invalid if the server responds with Unexpected response to RCPT TO All address at the same domain becomes invalid if the server responds with 421 4.7.0 Error: too many errors Dec 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants