skip to Main Content

I want to create email verification or validation where you need to enter valid address but you don’t need to send verification code to verify if email address is valid or not just an alert saying "invalid email" or something.

I have tried verifalia, I want that implementation but it’s not free.

3

Answers


  1. Validation vs. Plausible-Check

    If you ask this question, you need to differentiate between an actual email address validation and checking if the address is plausible.

    What is an email address verification?

    A verification is a process that checks if an email address actually exists and if the person who claims to have access to that address actually does.
    You can only really do that with a verification code or a user that has to open a verification link.

    What you can try is to send an email to the address and check if the email gets a 200 status code or a 404 status code. That way you can check if the email address leads to a mail server that is currently reachable. However, you can not validate if the server is currently just offline due to an error or maintenance nor can you check if the user has access to that mail. This means, that it technically is not a sufficient validation.

    Checking for plausibility means, that you check if an email address could technically be possible. It does not check if that email address really exists nor if the user can access it. That plausible check can be done with a regex: RFC 5322.

    (?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[x01-x08x0bx0cx0e-x1fx21x23-x5bx5d-x7f]|\[x01-x09x0bx0cx0e-x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])).){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[x01-x08x0bx0cx0e-x1fx21-x5ax53-x7f]|\[x01-x09x0bx0cx0e-x7f])+)])
    

    Services like Verifalia do not actually do email validation but check if they can reach the server by sending them a test mail and waiting for the HTTP response code. Other services even won’t do that but simply use the RFC5322 regex to check for plausibility.

    Login or Signup to reply.
  2. You can use the following alternative for verifalia:

    1. https://www.zerobounce.in/free-email-verifier/
    2. https://www.site24x7.com/tools/email-validator.html
      3.https://quickemailverification.com/tools/email-checker

    Also a basic code to answer your question just try it

    function validateEmail(email) {
        var re = /^(([^<>()[]\.,;:s@"]+(.[^<>()[]\.,;:s@"]+)*)|(".+"))@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}])|(([a-zA-Z-0-9]+.)+[a-zA-Z]{2,}))$/;
        return re.test(String(email).toLowerCase());
    }
    
    var email = prompt("Please enter your email:");
    if (!validateEmail(email)) {
        alert("Invalid email");
    }
    
    Login or Signup to reply.
  3. first create a one form in which there will be one label for notifying the "Email" after that there will be one textfield in which you have to set the input type as a "email". also you can write the this kind of required pattern in the input tag.

    required pattern="[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,}$

    after that add one submit button. and you can write the function for validation in script also.

    function validateEmail() {
          var emailInput = document.getElementById('email');
          var isValid = emailInput.checkValidity();
    
          if (!isValid) {
            alert('Invalid email');
            return false;
          }
    
          return true;
        }
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search