Confirm Email Validity of Your Mailing List with WayScript
Tags: tutorial, wayscript
Published: 2020-07-07 11:28:16

Introduction
------------

Let’s say that you’ve built your email mailing list, full of potential clients. Before sending messages to them, you might not want to waste money on emails that’ll never reach your potential customer due to the address being invalid.  
With Wayscript, you can verify email easily and increase your chances to hit valid email addresses.  
Let’s build a script that integrates Google Sheet, SendGrid, and Verify Emails module.

Prerequisites
-------------

For this post, here is some useful documentation to help you better understand the workflow.

*   Working with Google Sheet Trigger
*   [Working with Verify Email](https://docs.wayscript.com/library/modules/verify-emails)
*   [Working with conditions](https://docs.wayscript.com/getting_started/conditionals)
*   [Working with SendGrid](https://docs.wayscript.com/library/modules/sendgrid)

Google Sheet Trigger
--------------------

Every time a row will be added to a Google spreadsheet, the script will run. To make this, we’ll use Google Sheet Trigger. Add the trigger.  
  

![Adding Google Sheet Trigger](https://cdn.wayscript.com/blog_img/114/1.png)

The next step is the configuration. You’ll need to connect with your Google Sheet account, choose the mode, and the spreadsheet.  
  

![Google Sheet Configuration](https://cdn.wayscript.com/blog_img/114/2.png)

You’ll notice new items in the configuration panel. We’ll replace columns names with suitable variables names. The sheet I am using for this example looks like this.  
  

![Google Sheet Structure](https://cdn.wayscript.com/blog_img/114/3.png)

Only column B will be useful here. Let's name it email in the configuration.  
  

![Google Sheet outputs](https://cdn.wayscript.com/blog_img/114/4.png)

The trigger is ready now.

Verify Emails
-------------

Email verification can be achieved easily using the Verify Email module provided by Wayscript. When given an email address, you’ll get useful information such as for example Email format to check if the email syntax is right and SMTP test to check if the email really exists.  
  

![Verify Emails configuration](https://cdn.wayscript.com/blog_img/114/5.png)

We have the information we need. Let’s send a mail with SendGrid based on conditions.

SendGrid
--------

The next step is to send an email to the email address. Before doing that, let’s be sure we are not sending emails to an invalid email address.  
We will need a If condition and make sure Email\_format equal to Valid and SMTP\_Test equal to Passed. Add If as a new step and we'll write the conditions.  
  

![Adding the conditions](https://cdn.wayscript.com/blog_img/114/6.png)

Under the If branch, add the SendGrid module.  
  

![Adding Sendgrid module](https://cdn.wayscript.com/blog_img/114/7.png)

Add your account and important information.  
  

![SendGrid configuration](https://cdn.wayscript.com/blog_img/114/8.png)

Under the Else, we’ll add the Write Log module to print the email address if it’s not valid.  
  

![Write log module](https://cdn.wayscript.com/blog_img/114/9.png)

If you are confused, here is how your workflow will look like.  
  

![Workfow](https://cdn.wayscript.com/blog_img/114/10.png)

Conclusion
----------

Questions about this script or anything else? Join our [discord](https://discord.gg/VWbXSbj). We're always around to help. If you want to work the full script template, just find it [here](https://wayscript.com/user/mangabo_kolawole/IC3OG0lI).