Expand description

check-if-email-exists lets you check if an email address exists without sending any email.

Under the hood, it connects to the email address’s SMTP server, and, analyzing the server’s responses against some SMTP commands, finds out information about the email address, such as:

  • Email deliverability: Is an email sent to this address deliverable?
  • Syntax validation. Is the address syntactically valid?
  • DNS records validation. Does the domain of the email address have valid MX DNS records?
  • Disposable email address (DEA) validation. Is the address provided by a known disposable email address provider?
  • SMTP server validation. Can the mail exchanger of the email address domain be contacted successfully?
  • Mailbox disabled. Has this email address been disabled by the email provider?
  • Full inbox. Is the inbox of this mailbox full?
  • Catch-all address. Is this email address a catch-all address?
use check_if_email_exists::{check_email, CheckEmailInput, CheckEmailInputProxy};

async fn check() {
    // Let's say we want to test the deliverability of someone@gmail.com.
    let mut input = CheckEmailInput::new(vec!["someone@gmail.com".into()]);

    // Optionally, we can also tweak the configuration parameters used in the
    // verification.
    input
        .set_from_email("me@example.org".into()) // Used in the `MAIL FROM:` command
        .set_hello_name("example.org".into())    // Used in the `EHLO` command
        .set_smtp(587)                           // Use port 587 instead of 25
        .set_proxy(CheckEmailInputProxy {        // Use a SOCKS5 proxy to verify the email
            host: "my-proxy.io".into(),
            port: 1080
    });

    // Verify this input, using async/await syntax.
    let result = check_email(&input).await;

    // `result` is a `Vec<CheckEmailOutput>`, where the CheckEmailOutput
    // struct contains all information about one email.
    println!("{:?}", result);
}

Modules

Structs

Builder pattern for the input argument into the main email_exists function.

Perform the email verification via a specified proxy. The usage of a proxy is optional.

The result of the check_email function.

Enums

An enum to describe how confident we are that the recipient address is real.

Define how to apply TLS to a SMTP client connection. Will be converted into async_smtp::ClientSecurity.

Functions

The main function of this library: takes as input a list of email addresses to check. Then performs syntax, mx, smtp and misc checks, and outputs a list of results.