How does form submission email validation check for fake email addresses?

forms

#1

Hi,
I know that default HubSpot scripts can validate email not only with regex, free services domain check but also can determine if email phisically exist. If I insert email 'somestupidname@somefakedomainblah.com' into email field I get error: "Please enter a valid email address.". How to achieve this functionality with custom JS implementation?


#2

Hi @Peronczyk,

I'm not sure exactly how you would implement this on your end, but the following developer doc has some details on what HubSpot does to validate email addresses:


#3

I'm using JavaScript and I want my script to work simmilar as default HubSpot JS script. Article that you've mentioned does not help - there is no information about fake e-mail check. There is a link to this article: https://knowledge.hubspot.com/articles/kcs_article/forms/why-is-my-form-telling-me-to-enter-a-valid-email-address but there is no technical info in it.


#4

Hi @Peronczyk,

The only other checks we do that aren't explicitly mentioned in that article are to run an MX lookup for the email's domain, and run some additional proprietary email validation. HubSpot doesn't share the specific details of those checks, so you'd need to find other resources if you were looking to implement similar validation.


#5

Hey @Peronczyk

Maybe you could use the onFormSubmit callback to run your JavaScript?

However, onFormSubmit doesn't look like it's triggered early enough to validate the email address.

More information: https://developers.hubspot.com/docs/methods/forms/advanced_form_options

Good luck
Mike