0

Is it possible to check the validity of an email address, i.e. if the inbox really exists, just using Python?

I know this is a tricky question because it allows bad practices (spam), and I also know that email services (e.g. gmail) have security features to prevent this (I would like details on this too).

In short, I would like to know if this is possible and how to do it (I have already seen with smtplib), and if it is not possible, I would like people who are experts in this subject to explain it to me.

Thanks.

Edit : I specify that it is not a question of checking if a string is correctly formatted as an email (it's easy to check with regex), but to know if an email box exists behind an email address.

Bertrand
  • 89
  • 10
  • Does this answer your question? [How to check for valid email address?](https://stackoverflow.com/questions/8022530/how-to-check-for-valid-email-address/28982264#28982264) – Kache May 24 '23 at 20:54
  • Hello, yes i have already seen this question, but it seemed to me that some mailbox services deploy methods that prevent checking if an email address exists. If this is true, can we say that this is a formally impossible task? – Bertrand May 24 '23 at 21:03

1 Answers1

0

Well, first of all you have to check if an email has a correct format. Therefore you can use either regex or a library like email-validator.

To check if an inbox really exists or that the user actually owns this email, you could send an email and ask the user to verify his email. You can find many examples on how to implement this using python.