Description
I'm unable to run the deep email validator in the aws cloud shell / Lambda.
Please suggest.
Getting SMTP timeout / SMTP false.
Below is the code used.
const emailValidator = require('deep-email-validator');
// Get the email address from command-line arguments
const emailToValidate = process.argv[2];
async function validateEmail(email) {
try {
const { valid, reason, validators, address } = await emailValidator.validate(email);
console.log('validating smtp',validators?.smtp.valid)
if (valid) {
console.log(Email ${email} is valid and deliverable.
);
// Proceed with sending the email
} else {
console.error(Email ${email} is not valid. Reason: ${reason}
);
// Handle the case where the email address is not valid
}
} catch (error) {
console.error(An error occurred while validating the email: ${error.message}
);
// Handle the error (e.g., log it or show an error message)
}
}
if (!emailToValidate) {
console.error('Usage: node validateEmail.js ');
process.exit(1);
}
validateEmail(emailToValidate);
This works completely fine in the local environment.
But fails in AWS Cloud Shell or AWS Lambda.
Please look into this issue.