Build Your Own Email Validator Tool with Google Apps Script

Find Saas Video Reviews — it's free
Saas Video Reviews
Makeup
Personal Care

Build Your Own Email Validator Tool with Google Apps Script

Table of Contents

  1. Introduction
  2. Building your own email validator using Google Apps Script
  3. Overview of the email validator
    • 3.1 Did you mean?
    • 3.2 Domain
    • 3.3 Invalid format
    • 3.4 MX and SMTP check
    • 3.5 Free or paid email
    • 3.6 Email score
  4. Setting up the email validator
    • 4.1 Creating a Google Apps Script project
    • 4.2 Defining variables and objects
    • 4.3 Getting the API key from the settings tab
    • 4.4 Creating the check email validator function
  5. Calling the API and parsing the response
    • 5.1 Making the API call
    • 5.2 Checking the response code
    • 5.3 Parsing the JSON response
  6. Populating the JSON on your Google sheet
  7. Creating a custom menu
  8. Running the script
  9. Conclusion
  10. Frequently Asked Questions

Building Your Own Email Validator Using Google Apps Script

In this article, we will explore how to build your own email validator using Google Apps Script. If you have a large list of email addresses and you want to validate the legitimacy of the list before sending any emails, this script can help you. We will use a third-party validator that provides a response in the form of JSON. By reading the response and populating it on your Google sheet, you can easily validate and analyze your email list.

Overview of the Email Validator

Before we dive into the implementation details, let's have an overview of the email validator and its features.

3.1 Did you mean?

The email validator checks if the given email address is invalid and suggests similar email addresses with slight misspellings.

3.2 Domain

It identifies the domain to which the email address belongs.

3.3 Invalid format

The validator checks if the email address is in a valid format.

3.4 MX and SMTP check

It verifies if the email address is eligible to receive emails from any person.

3.5 Free or paid email

The validator determines if the email address is associated with a free or paid domain. It helps identify custom domains (paid) and popular free domains like Gmail and Yahoo.

3.6 Email score

The email score represents the spam score for the given email address. It ranges from zero to one, with a higher score indicating a higher likelihood of being spam.

Setting up the Email Validator

To start building your own email validator, follow these steps:

4.1 Creating a Google Apps Script project

Begin by creating a new Google Apps Script project. Go to Tools > Script Editor and name your project as "Email Validator".

4.2 Defining variables and objects

Create the necessary variables and objects for the script. You will need a sheet object, settings tab object, and validator tab object to access spreadsheet data.

4.3 Getting the API key from the settings tab

Retrieve the API key from the settings tab of your Google sheet. The API key is required to make API calls for email validation. Be sure to replace the existing API key with your own.

4.4 Creating the check email validator function

Create the main function called checkEmailValidator(). This function will check each email address in the list and make API calls for validation. Use a for loop to iterate through the email list and retrieve the email address during each iteration.

Calling the API and Parsing the Response

To validate the email addresses, we need to call the API and parse the response. Follow these steps:

5.1 Making the API call

Use the URLFetchApp class to make an API call. Pass the API URL as the parameter for the fetch method.

5.2 Checking the response code

Before reading the JSON response, validate the response code. A successful response code is 200.

5.3 Parsing the JSON response

Parse the JSON response and locate the required information using Object notation. Retrieve the response using fetch.getContentText().

Populating the JSON on Your Google Sheet

To display the validation results, populate the JSON response on your Google sheet. Use the setValue method to set the value for each column of the validator tab.

Creating a Custom Menu

To simplify the script execution, create a custom menu that allows you to run the email validator directly from your Google sheet. This menu will be added using the onOpen function, which executes when the Google sheet is launched.

Running the Script

Once everything is set up, reload the Google sheet and you will see the custom menu populated. Clicking on "Run Email Validator" will execute the script, validating the email list.

Conclusion

By following the steps outlined in this article, you can build your own email validator using Google Apps Script. It allows you to validate and analyze your email list easily, ensuring your emails reach legitimate recipients.


Frequently Asked Questions

Q: Can I use a different email validation API instead of the one mentioned in this article?

A: Yes, you can use any email validation API of your choice. Just make sure to modify the script to accommodate the specific API's requirements.

Q: How accurate is the email validation process?

A: The accuracy of the email validation process depends on the email validation API you use. Different APIs may have different levels of accuracy.

Q: What is the purpose of the email score?

A: The email score indicates the likelihood of an email being classified as spam. A higher score suggests a higher chance of it being marked as spam.

Are you spending too much time on makeup and daily care?

Saas Video Reviews
1M+
Makeup
5M+
Personal care
800K+
WHY YOU SHOULD CHOOSE SaasVideoReviews

SaasVideoReviews has the world's largest selection of Saas Video Reviews to choose from, and each Saas Video Reviews has a large number of Saas Video Reviews, so you can choose Saas Video Reviews for Saas Video Reviews!

Browse More Content
Convert
Maker
Editor
Analyzer
Calculator
sample
Checker
Detector
Scrape
Summarize
Optimizer
Rewriter
Exporter
Extractor