A Python package written in Rust for email verification without sending any emails.

Overview

PyRustify

PyRustify is a Python package written in Rust that verifies the email addresses.

Features

Feature Description
Syntax validation Checks if the email address has a valid syntax according to RFC 5322
MX lookup Checks if the email address has valid MX records and returns them if they exist
Email deliverability Checks if the email address can receive mail by performing a SMTP handshake with the mail server
Misc Checks if the email address is disposable, free or a role account using predefined lists of domains and prefixes

Installation

To install PyRustify, run the following command:

pip install pyrustify

Usage

To use PyRustify, you need to import it in your Python code and call either verify_email or verify_emails function. The verify_email function takes a single email address as an argument and returns a dictionary with the verification results. The verify_emails function takes a list of email addresses as an argument and returns a list of dictionaries with the verification results for each email address.

For example:

from pyrustify import verify_email, verify_emails

# Verify a single email address
response = verify_email('[email protected]') 
# Or a list of email addresses
response = verify_emails(['[email protected]','[email protected]'])
print(response)
# {
    # "email": "[email protected]",
    # "has_valid_syntax": true,
    # "mx": {
        # "has_mx_records": true,
        # "mx_records": [
            # "alt1.gmail-smtp-in.l.google.com.",
            # "alt3.gmail-smtp-in.l.google.com.",
            # "alt4.gmail-smtp-in.l.google.com.",
            # "alt2.gmail-smtp-in.l.google.com.",
            # "gmail-smtp-in.l.google.com."
        # ]
    # },
    # "misc": {
        # "is_disposable": false,
        # "is_free": true,
        # "is_role_account": true
    # },
    # "smtp": {
        # "is_deliverable": false
    # }
# }

Configuration

You can configure PyRustify by setting the following environment variables:

  • FROM_EMAIL: The email address to use as the sender in the SMTP request. Default is [email protected].
  • HELLO_NAME: The domain name to use in the SMTP request. Default is localhost.
  • SMTP_PORT: The port number to use for the SMTP request. Default is 25.
  • SMTP_TIMEOUT: The timeout in seconds for the SMTP request. Default is 10.
  • CHECK_SMTP: Whether to check the email deliverability by sending a SMTP request. Default is false.
  • CHECK_MX: Whether to check the MX records of the email address. Default is false.
  • CHECK_MISC: Whether to check the misc features of the email address. Default is false.
  • USE_SOCKS5: Whether to use a SOCKS5 proxy for the SMTP request. Default is false.
  • SOCKS5_HOST: The hostname or IP address of the SOCKS5 proxy server.
  • SOCKS5_PORT: The port number to use for the SOCKS5 proxy server.
  • SOCKS5_USERNAME: The username for the SOCKS5 proxy server. Optional.
  • SOCKS5_PASSWORD: The password for the SOCKS5 proxy server. Optional.

For example, you can set these variables in your terminal before running your Python script:

export CHECK_SMTP=true
export CHECK_MX=true
export CHECK_MISC=true

Credits

PyRustify uses the following sources for its miscellaneous checks:

Note

To check the SMTP deliverability, you need to have port 25 open on your machine. Some ISPs may block this port by default, so you may need to contact them or use a proxy server to bypass this restriction.

License

PyRustify is licensed under the MIT License. See LICENSE for more details.

You might also like...
Rust Imaging Library's Python binding: A performant and high-level image processing library for Python written in Rust

ril-py Rust Imaging Library for Python: Python bindings for ril, a performant and high-level image processing library written in Rust. What's this? Th

The high-speed IAPWS-IF97 package in Rust with C and Python binding
The high-speed IAPWS-IF97 package in Rust with C and Python binding

SEUIF97 This is the Rust implementation of the high-speed IAPWS-IF97 package seuif97 with C and Python binding. It is suitable for computation-intensi

Simple but convenient CLI-based Matrix client app for sending and receiving (in Rust)

matrix-commander-rs simple but convenient CLI-based Matrix client app for sending and receiving Help create this Rust program! This project is current

CLI program for sending one-off requests to the VTube Studio API

vtubestudio-cli (vts) CLI program for sending one-off requests to the VTube Studio API. It connects to the websocket, authenticates, performs one or t

dhcpm is a CLI tool for constructing & sending DHCP messages

dhcpm Sponsor Thank you to Bluecat for sponsoring this work! dhcpm leverages dhcproto check that out for the DHCP protocol. About A cli tool (and dhcp

Command-line HTTP client for sending a POST request to specified URI on each stdin line.

line2httppost Simple tool to read lines from stdin and post each line as separate POST request to a specified URL (TCP connection is reused though). G

simple but convenient CLI-based Nostr client app for following users and sending DMs

nostr-commander-rs TLDR: simple but convenient CLI-based Nostr client app for publishing, sending DMs, as well as following users and channels nostr-c

Core Lightning plugin for sending zap (NIP-57) notes

Core Lightning plugin for sending zap events You can add the plugin by copying it to CLN's plugin directory or by adding the following line to your co

sg = Steam Guard, access sg verification code locally.

Steam Guard CLI Access your Steam Guard token locally. Credit https://github.com/steevp/UpdogFarmer/blob/master/app/src/main/java/com/steevsapps/idled

Releases(v0.1.0)
Owner
Mng
Mng
Send emails right from the terminal using Rust!

Send emails right from the terminal using Rust!

Dhravya Shah 7 Dec 21, 2022
Standard Graphics is a command-line tool for printing 2D graphics from any language to any screen.

2D graphics in any programming language with just print statements!

Caleb Winston 123 Nov 20, 2022
📦 A Python package manager written in Rust inspired by Cargo.

huak About A Python package manager written in Rust. The Cargo for Python. ⚠️ Disclaimer: huak is currently in its proof-of-concept (PoC) phase. Huak

Chris Pryer 186 Jan 9, 2023
📦 A Python package manager written in Rust inspired by Cargo.

huak About A Python package manager written in Rust. The Cargo for Python. ⚠️ Disclaimer: huak is currently in its Alpha phase. Huak aims to support a

Chris Pryer 161 Oct 9, 2022
Python package for topological data analysis written in Rust. Not limited to just H0 and H1.

Topological Data Analysis (TDA) Contents Installation Compiling from source Roadmap TDA is a python package for topological data analysis written in R

António Leitão 5 Feb 12, 2024
Command line tool for cheap and efficient email automation written in Rust

Pigeon Pigeon is a command line tool for automating your email workflow in a cheap and efficient way. Utilize your most efficient dev tools you are al

null 57 Nov 20, 2022
Open source email client written in Rust and Dioxus. Under 🏗️

Blazemail A full-featued, beautiful, mail client that doesn't suck. Works on mac, windows, linux, mobile, web, etc. Features, status Blazemail is curr

Jon Kelley 13 Dec 19, 2022
Email test server for development, written in Rust

MailCrab Email test server for development, written in Rust. Inspired by MailHog and MailCatcher. MailCrab was created as an exercise in Rust, trying

Tweede golf 30 Feb 7, 2023
Tool written in Rust to enumerate the valid email addresses of an Azure/Office 365 Tenant

AzureEmailChecker Tool written in Rust to enumerate the valid email addresses of an Azure/Office 365 Tenant. It is multi threaded and makes no connect

Pierre 11 Feb 27, 2024
Catch Tailwindcss Errors at Compile-Time Before They Catch You, without making any change to your code! Supports overriding, extending, custom classes, custom modifiers, Plugins and many more 🚀🔥🦀

twust Twust is a powerful static checker in rust for TailwindCSS class names at compile-time. Table of Contents Overview Installation Usage Statement

null 15 Nov 8, 2023