How to check a mail id exist or not

There are several ways to check if an email address exists or not:

  1. Using a simple email validation library: You can use a library like email-validator in Python or email-validator in JavaScript to validate the email address. These libraries can check if the email address is in the correct format and if it's likely to exist.
  2. Sending a verification email: You can send a verification email to the email address and check if it's delivered. If the email is delivered, it's likely that the email address exists. You can use a service like Mailgun or Sendgrid to send the verification email.
  3. Using a third-party API: There are several third-party APIs that can check if an email address exists, such as:
    • verify-email API: This API allows you to verify if an email address exists or not.
    • email-check API: This API checks if an email address exists or not and also provides information about the email address, such as the domain and the top-level domain.
    • WhoisXML API: This API provides information about the domain and the email address, including whether the email address exists or not.
  4. Using a DNS lookup: You can perform a DNS lookup to check if the email address exists. If the email address is associated with a domain, you can perform a DNS lookup to check if the domain exists. If the domain exists, it's likely that the email address exists.
  5. Using a web scraping technique: You can use a web scraping technique to check if the email address exists. For example, you can send a request to a website and check if the email address is listed on the website.

Here's an example of how you can use the email-validator library in Python to validate an email address:

import email_validator

email = "[email protected]"
try:
    email_validator.validate_email(email)
    print("Email address is valid and likely exists")
except email_validator.EmailNotValidError:
    print("Email address is invalid or does not exist")

And here's an example of how you can use the verify-email API to check if an email address exists:

import requests

email = "[email protected]"
url = "https://api.verify-email.io/v2/validate"
params = {"email": email}
response = requests.get(url, params=params)
if response.status_code == 200:
    print("Email address exists")
else:
    print("Email address does not exist")

Note that these methods are not foolproof and there's always a chance that an email address may exist even if it's not validated or verified.