Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

204
Views
How to validate only working Email in JavaScript?

How to validate only working Email in JavaScript? Actually, I want only working email excluding (@gmail.com, @outlook.com, @hotmail.com, @yahoo.com etc). I want only working emails like abc@stack.com etc.

about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

This code is also working!

let text = "abc@hotmail.com";
let domain = text.substring(text.lastIndexOf("@"));
if(domain == "@gmail.com" || domain == "@yahoo.com" || domain == "@hotmail.com" || domain == "@outlook.com"){
    console.error("Wrong format")
}else{
    console.log("working email")
}

about 4 years ago · Juan Pablo Isaza Report

0

One way is to get the domain part from the email, and check it against the list of personal email domains:

const workingEmailValidator = email => 
    !['gmail', 'hotmail', 'yahoo', 'outlook'].includes(email.split('@')[1].split('.')[0])

console.log(workingEmailValidator('xyz@sss.com'))
about 4 years ago · Juan Pablo Isaza Report

0

I use my own function after checking if email is valid then you can check if it is work email or not :

const notAllowed = ["gmail.com", "email.com", "yahoo.com", "outlook.com"];
 function check(email) {
    const lastPortion = email.split("@")[1].toLowerCase();
     if (notAllowed.includes(lastPortion)) {
          console.log("Please enter work email");
          return false;
     }
     return true;
}
check("abc@paiman.com");
check("abc@gmail.com.com");
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!