Replies

Highlighted

DarrenBiz

08-05-2019

So another piece to this puzzle (provided by Support) is the option value for the valid characters in an email address XtkEmail_Characters. I tested this value and this Option value is definitely being used by the mystery validation function to check for valid characters in the email before the write happens.

email_chars.png

What they couldn't confirm was how this was applied to the email address (local-part or domain or both). Nor could they confirm what other checks were being performed before the recipient Write was attempted.

Highlighted

DarrenBiz

13-06-2019

OK - I finally have an answer on how ACC determines a valid email. It took way more effort than I expected but we got an answer:

So I am assuming that the first part of this response is the dataPolicy check and the second is a regex against the XtkEmail_Characters option. e.g. something like this

loadLibrary("xtk:shared/nl.js");

loadLibrary("xtk:shared/dataPolicy.js");

var email = "blah232456@gmail.com";

/**

*

* Function to determine if an email is valid for the Adobe Campaign

* database checks. This process checks using the default email dataPolicy

* and the option value XtkEmail_Characters.

*

* @param email {string} email address to test

* @return true(valid) | false(invalid)

*

**/ 

function isValidAdobeEmail( email ) { 

var patt = "[^@" + getOption('XtkEmail_Characters').replace(/[.*+?\-^${}()|[\]\\]/g, '\\\$&') + "]";

//logInfo("EmailFunctions.js::isValidAdobeEmail() - Escaped XtkEmail_Characters: " + patt);

var regex = new RegExp(patt, "g"); 

var testFlag = !regex.test(email); 

//logInfo("Result of XtkEmail_Characters test: " + ((testFlag)?"valid":"invalid"));

var dataPolicyResult = !NL.isEmpty(NL.DataPolicy.filter("email", email)); 

//logInfo("Result of dataPolicy email test: " + ((!NL.isEmpty(dataPolicyResult))?"valid":"invalid"));

return testFlag && dataPolicyResult; 

}

//Test the email

if( isValidAdobeEmail(email) ) {

  //email address is valid

} else {

  //email is invalid

}

Edit: minimised the code

Highlighted

wodnicki

MVP

14-06-2019

Hi,

No there is no regex here. The code is matching characters after splitting the string into @ and .

Pseudocode in js would be:

str.split(/[@.]/).filter(function(_){

    return _.match(/^[XtkEmail_Characters as a character class]+$/);

}).length >= 3

Thanks,

-Jon