validate email using regex
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
const nodemailer = require ('nodemailer');
|
||||
|
||||
module.exports = {
|
||||
validateEmailFromAlexaResponse: function (email) {
|
||||
transformEmailFromAlexaResponse: function (email) {
|
||||
//email from alexa response will contain words instead of symbols, like :
|
||||
//at = @
|
||||
//underscore = _
|
||||
@@ -14,10 +14,13 @@ module.exports = {
|
||||
.replace (/dash/gi, '-')
|
||||
.replace (/dot/gi, '.');
|
||||
|
||||
//Validate here with some email validation regex
|
||||
return transformedEmail;
|
||||
},
|
||||
|
||||
//return true if email is valid
|
||||
return true;
|
||||
isEmailValid : function(email){
|
||||
let validEmailRegex = /^(([^<>()\[\]\\.,;:\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 validEmailRegex.test(email);
|
||||
},
|
||||
|
||||
sendEmal: function (name, fromEmail, message, toEmail) {
|
||||
|
||||
Reference in New Issue
Block a user