Email Validation with Python and Minelead

 

 

b664b20ff7f8b82c667c450517fc629c

 

 

 

Email verification is an essential tool for sales teams, as it enables them to effectively communicate with potential customers and build strong relationships. By verifying email addresses, sales teams can ensure that the contact information they have is accurate, reducing the risk of undeliverable or bounced emails. This helps to improve their email deliverability and increase the chances of their messages being read.



Additionally, email verification can also help to prevent fraud and abuse, ensuring that sales teams are communicating with real people and not fake or disposable email addresses. This can help them to avoid wasting time and resources on unqualified leads. By verifying email addresses, sales people can improve their productivity and focus their efforts on reaching the right people with the right message, ultimately increasing their chances of closing deals and reaching their sales goals.



In this blog, We'll see how to check emails from a CSV file with python using Minelead API.

 

 

Requirements

 

1- You need to have python installed.

2- Install requests and pandas packages using the command: pip install requests pandas.

3- Understanding what is an api and how to use it.

4- Get the api key from your Minelead profile.

 

Outlines

 

 

Why Validate Email Addresses

 

Read Emails From a CSV File

 

How Can I Verify if The Email Exists

 

Extract Results and Store it in New CSV File

 

 

Why Validate Email Addresses

 

Another way where email verification can benefit us is by improving the deliverability of our marketing and promotional emails. By verifying that email addresses are valid.

 

sales people can reduce the number of bounced emails and undelivered messages, which can negatively impact their sender reputation and make it more difficult for their emails to reach the inboxes of potential customers. You can learn how to build your email reputation for your outreach campaigns here.

 

 

Additionally, email verification can help to reduce the number of spam complaints, which can also harm a sender's reputation and make it more difficult to reach potential customers.

 

 

By using email verification, sales teams can ensure that their emails are reaching the right people and increase the chances of those people engaging with their marketing campaigns.

 

 

Read Emails From a CSV File

 

 

*The file we will start with has to have an email column, the one used in this example is the results of Minelead Search for minelead.io.

 

When it comes to procesing CSV files with python, Pandas is the best tool, It is a popular library that is widely used for data manipulation and analysis. It provides powerful data structures and data analysis tools that make it easy to work with structured data in Python.

In this step we are interested in using its read_csv method that will help us retrieve the unverified emails in the file and iterate over the rows.

 

import requests

import pandas as pd

import csv

 

def main():

 

    emails = pd.read_csv('leads.csv',encoding='utf-8')

 

    for row in emails.itertuples():

        print(row.email)

 

main()

 

 

This function call will print to use every row's email, after checking that it works, we will make a POST request for every email.

 

 

Check Emails Using Minelead API

 

 

To call Minelead API we need To regisiter for free and retrieve the api key from the profile page.


After that is done, we include it in our script and make the api calls.

 

api_key = 'Your_Api_Key_Goes_Here'

 

def main():

 

    emails = pd.read_csv('leads.csv',encoding='utf-8')

    verified_emails = []

 

    for row in emails.itertuples():

 

    try:

        x = requests.get(f'https://api.minelead.io/v1/validate/?email={row.email}&key={api_key}').json()

 

        if (x.get('exist')==True):

            verified_emails.append(x.get('email'))

 

    except Exception as e:

        print(e)

 

    print(verified_emails)

 

main()

 

 

 

Our function now will receive the response from the Minelead API, and get the field that indicates whether the email exists or not.

 

We also used to Try Except method to prevent any error from crashing our script.

 

The emails verified will be stored in the verified_emails list for now.

 

Note: This operation may take some time in order to check every email, and every verification take one credit from the 25 credits offered for Free users by Minelead.

 

 

Store Verified Emails in CSV File

 

 

To write a CSV file we can use a built-in module called csv and iterate over the verified list to put every element in a new row.
 

 

import requests

import pandas as pd

import csv

 

 

api_key = 'Your_Api_Key_Goes_Here'

 

def main():

 

    emails = pd.read_csv('leads.csv',encoding='utf-8')

    verified_emails = []

 

    for row in emails.itertuples():

 

    try:

        x = requests.get(f'https://api.minelead.io/v1/validate/?email={row.email}&key={api_key}').json()

 

        if (x.get('exist')==True):

            verified_emails.append(x.get('email'))

 

    except Exception as e:

        print(e)

 

    with open('verified_emails.csv','w', newline='') as file:

 

        writer = csv.writer(file)

        writer.writerow(['email'])

 

        for email in verified_emails:

            writer.writerow([email])


 

main()

 

 

Conclusion

 

In conclusion, email verification is an important step in ensuring the quality of your email list. By using Python and the Minelead API, we were able to quickly and easily verify the validity of a list of email addresses. this will improve the deliverability of your email campaigns, and avoid costly bounces and spam complaints.

 

Suche...
×
Passwort festlegen
Sie haben Ihr Konto mit Google SSO erstellt. Sie müssen ein Passwort festlegen.

Telefonische Bestätigung