-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
22 lines (20 loc) · 734 Bytes
/
index.js
File metadata and controls
22 lines (20 loc) · 734 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const axios = require('axios');
const api_url = 'http://apilayer.net/api/check?access_key';
const api_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; //Enter the key obtained from mailboxlayer.com
const email = ''; //Enter email id to be validated and checked
const entire_url = `${api_url}=${api_key}&email=${email}&smtp=1&format=1`;
axios.get(entire_url)
.then(response => {
if(!response.data.format_valid){
console.log("Invalid format!");
return;
}
if(!response.data.smtp_check){
console.log("Email address not registered.")
return;
}
else{
console.log("Success!");
}
})
.catch(error => console.log('Error', error));