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

Does verification not work with Google SMTPs anymore due to blanket 250 response? #84

Closed im-kent closed 3 weeks ago

im-kent commented 4 weeks ago

Not necessarily the code itself, but to verify emails (and catch-alls), the method is to compose an email through the SMTP connection but not send it, and the SMTP server would either respond 250 OK or 550 error (for not found).

However, while doing this, regardless of whether the account exists, Google SMTP responds 250 OK after RCPT TO: accountthatdoesnotexist@theirdomain.com.

Do others here know something I don't about verifying catch-alls?

Additionally, to even send a MAIL FROM command to Google or Outlook servers, it is required to authenticate (i.e. have an account with them). Is this expected?

strein commented 3 weeks ago

No issues for me with Google. This test code correctly results in a 550 error:

require '../vendor/autoload.php';
use SMTPValidateEmail\Validator as SmtpEmailValidator;

$email     = 'foobar_unknown@gmail.com';
$sender    = 'otto@test.de';
$validator = new SmtpEmailValidator($email, $sender);

// If debug mode is turned on, logged data is printed as it happens:
$validator->debug = true;
$results   = $validator->validate();

print_r($results);

if ($results[$email]) {
    echo "$email is valid";
} else {
    echo "$email is INVALID";
}
im-kent commented 3 weeks ago

Thank you for the response! After some digging into this, I realized this is error on my part (sorry, totally new here). I had originally attempted connection via port 25. When that failed (due to my ISP blocking port 25), I decided to use one of the SSL ports, incorrectly assuming that the SMTP server functions the same regardless of the ports. This is apparently not the case.

I have not been able to successfully try verification yet, I need to figure out how I can get port 25 access first, but I suspect that once I get access to port 25, I should be fine.

I'll close this issue and re-open a new ticket if my access to port 25 does not yield the expected result.