Skip to main content

The simplest library for email verification for Flask.

Project description

The easiest way to verify emails in your Flask application.

Meta

Prerequisites

To use this library, you’ll need to create a free Email Verification API account: https://emailverification.whoisxmlapi.com/

If you haven’t done this yet, please do so now.

Installation

To install Flask-EmailVerifier using pypi, simply run:

$ pip install Flask-EmailVerifier

In the root of your project directory.

Usage

Once you have Flask-EmailVerifier installed, you can use it to easily verify an email address.

This library gives you access to the Email Verification API that you can use in your application in any number of ways.

Here’s a simple Flask app that makes use of the email address verification and returns an email address information:

from flask import Flask, make_response
from flask_email_verifier import EmailVerifier
from json import dumps, loads

app = Flask(__name__)
# Initialize the extension
verifier = EmailVerifier(app)

@app.route('/email/<email>')
def email(email):
    # Retrieve an info for the given email address
    email_address_info = verifier.verify(email)
    if email_address_info is not None:
        data = dumps(loads(email_address_info.json_string), indent=4)
        resp = make_response(data, 200)
        resp.headers['Content-Type'] = 'application/json'
    else:
        resp = make_response('None', 404)
    return resp

Don’t forget to specify your API key:

$ export EMAIL_VERIFIER_KEY='your-key'

Here’s the sort of data you might get back when performing a email verification request:

{
    "emailAddress": "test.email@gmail.com",
    "formatCheck": "true",
    "smtpCheck": "false",
    "dnsCheck": "true",
    "freeCheck": "true",
    "disposableCheck": "false",
    "catchAllCheck": "false",
    "mxRecords": [
        "alt3.gmail-smtp-in.l.google.com",
        "alt1.gmail-smtp-in.l.google.com",
        "alt2.gmail-smtp-in.l.google.com",
        "alt4.gmail-smtp-in.l.google.com",
        "gmail-smtp-in.l.google.com"
    ],
    "audit": {
        "auditCreatedDate": "2018-11-14 13:05:09.000 UTC",
        "auditUpdatedDate": "2018-11-14 13:05:09.000 UTC"
    }
}

In the event an email verification request can’t finish successfully, the data returned will be None. This library will never throw an exception. This decision was made strategically: if you cannot verify user’s email, it doesn’t mean that this user is bad.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Flask-EmailVerifier-0.1.0.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

Flask_EmailVerifier-0.1.0-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file Flask-EmailVerifier-0.1.0.tar.gz.

File metadata

  • Download URL: Flask-EmailVerifier-0.1.0.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5

File hashes

Hashes for Flask-EmailVerifier-0.1.0.tar.gz
Algorithm Hash digest
SHA256 73a66ff0737b8cbc70e244b4e686f4ba865586c21bcd5e0c7b0591497489b0fe
MD5 7ba13662b9461228452bc93d6295c671
BLAKE2b-256 77539759fd871c9bdcd90bd0425ef5c0159ba66c382e448b69e4489bc8409098

See more details on using hashes here.

File details

Details for the file Flask_EmailVerifier-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: Flask_EmailVerifier-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5

File hashes

Hashes for Flask_EmailVerifier-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5d3f684503a50a40c230d8902446e49ac603f0a60eb84e24ce7701db799cb336
MD5 2a925f5f52d511d6e35f8069c9e709a0
BLAKE2b-256 a9e8b27295a4a7c91a29bf47d6ea710432c8cbd880441c89128eac0fa36f0006

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page