Skip to content

EnrowAPI/email-verifier-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Email Verifier - Rust Library

crates.io License: MIT GitHub stars Last commit

Verify email addresses in real time. Check deliverability, detect disposable and catch-all domains, and clean your email lists before sending.

Powered by Enrow -- real-time SMTP-level verification with high accuracy on catch-all domains.

Installation

Add to your Cargo.toml:

[dependencies]
email-verifier = "1.0"
tokio = { version = "1", features = ["full"] }

Simple Usage

use email_verifier::{verify_email, get_verification_result, VerifyEmailParams};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let params = VerifyEmailParams {
        email: "tcook@apple.com".into(),
        webhook: None,
    };

    let verification = verify_email("your_api_key", &params).await?;
    let result = get_verification_result("your_api_key", &verification.id).await?;

    println!("{}", result.email.unwrap_or_default());         // tcook@apple.com
    println!("{}", result.qualification.unwrap_or_default()); // valid

    Ok(())
}

verify_email returns a verification ID. The verification runs asynchronously -- call get_verification_result to retrieve the result once it's ready. You can also pass a webhook URL to get notified automatically.

Bulk verification

use email_verifier::{verify_emails, get_verification_results, VerifyEmailsParams, BulkVerification};

let params = VerifyEmailsParams {
    verifications: vec![
        BulkVerification {
            email: "tcook@apple.com".into(),
            custom: None,
        },
        BulkVerification {
            email: "satya@microsoft.com".into(),
            custom: None,
        },
        BulkVerification {
            email: "jensen@nvidia.com".into(),
            custom: None,
        },
    ],
    webhook: None,
};

let batch = verify_emails("your_api_key", &params).await?;
// batch.batch_id, batch.total, batch.status

let results = get_verification_results("your_api_key", &batch.batch_id).await?;
// results.results -- Vec<VerificationResult>

Up to 5,000 verifications per batch. Pass a webhook URL to get notified when the batch completes.

Error handling

match verify_email("bad_key", &params).await {
    Ok(result) => println!("Verified: {:?}", result),
    Err(e) => {
        // e contains the API error description
        // Common errors:
        // - "Invalid or missing API key" (401)
        // - "Your credit balance is insufficient." (402)
        // - "Rate limit exceeded" (429)
        eprintln!("Error: {}", e);
    }
}

Getting an API key

Register at app.enrow.io to get your API key. You get 50 free credits (= 200 verifications) with no credit card required. Each verification costs 0.25 credits.

Paid plans start at $17/mo for 1,000 credits up to $497/mo for 100,000 credits. See pricing.

Documentation

License

MIT -- see LICENSE for details.

About

Verify email addresses for deliverability with catch-all verification — Rust library powered by Enrow

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages