mfbx9da4 / deep-email-validator

Validates regex, typos, disposable, dns and smtp
MIT License
861 stars 87 forks source link

Deep email validator in the aws cloud shell / Lambda not working #76

Open sairaja opened 11 months ago

sairaja commented 11 months ago

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.

PaulSpaurgen commented 11 months ago

Hi sairaja, I am also facing the same issue did you find any solution ?

arobida-adzz commented 8 months ago

not sure if it will work but I have found using keepAlive fixes issues with lambadas that make external api calls:

{
httpAgent: new http.Agent({ keepAlive: true, keepAliveMsecs: 10000 }),
httpsAgent: new https.Agent({ keepAlive: true, keepAliveMsecs: 10000 }),
timeout: 5000
}
sfarkas1988 commented 1 month ago

aws does not allow 25 outbound calls which is needed for smtp checks. I just found out after a full day of debugging. I.e: https://repost.aws/questions/QUhOiYfU2ESzyjHNFLdih5lQ/smtp-port-25-outgoing-connections-blocked

AshleyJackson commented 4 days ago

aws does not allow 25 outbound calls which is needed for smtp checks. I just found out after a full day of debugging. I.e: https://repost.aws/questions/QUhOiYfU2ESzyjHNFLdih5lQ/smtp-port-25-outgoing-connections-blocked

This is what i've found as well while building Lambda's using AWS SST. Thanks @sfarkas1988