Check if someone’s email is @ their website — i.e. is their work address — using FlowBoost

Requiring a person’s work address on forms may be too frictional, or you simply may not control the lead source. But you can still derive value from the data points you do have.

An example is comparing someone’s Website value with their Email. If Website — derived from Company via enrichment is intavro.com and Email is sandy@intavro.com, that’s a positive signal.

FlowBoost has the precompiled function FBUtil.string.partsFromEmail()so you don’t have to code that yourself, and of course offers the standard URL API as FBHttp.URL.

So it’s as as simple as:

let emailAddress = {{lead.Email Address}};
let website = {{lead.Website}};

let emailParts = FBUtil.string.partsFromEmail(emailAddress);

// Website field may or may not contain the leading http://
let webURL;
if( FBHttp.URL.canParse(website) ) {
  webURL = FBHttp.URL.parse(website);
} else {
  webURL = FBHttp.URL.parse("https://" + website);
}

itMatches = emailParts.domain == webURL.hostname;

Then itMatches is a Boolean to use in a response mapping.

Notice I didn’t toLowerCase() either side. That’s because partsFromEmail().domain is already lowercased, as is new URL().hostname.[1]

Alternate approach

I prefer to parse both values into parts/components for flexibility, but technically you can do:

let emailAddress = {{lead.Email Address}};

// Website field may or may not contain the leading http://
let webURL;
if( FBHttp.URL.canParse(website) ) {
  webURL = FBHttp.URL.parse(website);
} else {
  webURL = FBHttp.URL.parse("https://" + website);
}

itMatches = emailAddress.toLowerCase().endsWith("@" + webURL.hostname);
Notes

[1] Specifically because the protocol is https: and that’s a special scheme in the standard. You can use the URL() constructor with any protocol, but non-special ones don’t lowercase hostname because stuff that doesn’t use DNS may be case-sensitive. (URLs are general-purpose and hosts aren’t always DNS-based hosts!)