check-if-email-exists

repository·master·Indexed 27 days ago

https://github.com/reacherhq/check-if-email-exists

An open-source tool and API for verifying if an email address exists and is reachable without sending an email. It provides syntax validation, DNS/MX record checks, and SMTP server verification. Available as a Rust library, a CLI tool, and a Docker-based HTTP backend (reacher_backend v0.11.7) with support for SOCKS5 proxies and horizontal scaling via RabbitMQ or AWS SQS.

Tokens
19.5K
Snippets
41
Records
121
Agent score
93%

What's inside check-if-email-exists

  1. Understand Reacher Licensing (AGPL-3.0 vs Commercial)

    master

    Reacher is available under two licensing models depending on your use case:

    Open-Source (AGPL-3.0)

    Reacher is distributed under the AGPL-3.0 license. This is suitable for projects that are also open-source.

    Critical Restriction: If you integrate Reacher into a web service or proprietary software under the AGPL-3.0, you are required to make your entire source code (including any modifications) publicly available under the same license.

    Commercial License

    If you intend to integrate Reacher into proprietary software or services and do not wish to make your own source code public, you must obtain a Commercial License. This allows you to use the software without the copyleft requirements of the AGPL-3.0.

    Note that both licenses provide access to the exact same Reacher software functionality.

  2. Compare Reacher SaaS and Self-Hosting options

    master

    Reacher offers two deployment models: SaaS for managed cloud usage and Self-Hosting for full infrastructure control. Choose based on your volume requirements, data privacy needs, and maintenance capacity.

    Comparison Summary

    FeatureSaaSSelf-Hosting
    VolumeLimited to 10k verifications per monthUnlimited verifications
    CostMonthly subscriptionMonthly subscription + server costs + optional proxy costs
    Setup TimeInstantRequires installation and setup
    MaintenanceFully managed by ReacherManaged by your IT team
    Data OwnershipData stored on Reacher serversFull ownership; no data sent to Reacher
    Bulk VerificationNot supportedSupported

    Reacher SaaS

    • Access: https://app.reacher.email
    • Best for: Users who want instant setup and zero infrastructure management.
    • Capabilities: Verify emails directly via the Reacher Dashboard.

    Self-Hosting Reacher

    • Best for: Users requiring unlimited volume, bulk verification, or strict data sovereignty.
    • Capabilities: Provides full control over the environment and data using the same verification engine as the SaaS version.
    • Note: Self-hosting can be part of a Commercial License Trial via the install.md guide.
  3. Understand Commercial License Trial limitations

    master

    The Commercial License Trial is intended for internal testing and non-commercial purposes only. It has the following constraints:

    • Proxy: Uses embedded Proxy4Smtp for SMTP verifications to ensure reliability in cloud environments.
    • Rate Limits: Capped at 60 verifications per minute and 10,000 verifications per day.
    • Usage Tracking: Anonymized verification results are sent to Reacher to monitor usage and detect abuse.
    • Prohibition: Cannot be used in production environments for commercial applications. Abuse will result in an immediate account ban.
  4. Use check-if-email-exists in Rust

    master

    To use the library programmatically in a Rust project, add it to your Cargo.toml:

    [dependencies]
    check-if-email-exists = "0.9"

    Then, use check_email with CheckEmailInput to perform asynchronous verification:

    use check_if_email_exists::{check_email, CheckEmailInput, CheckEmailInputProxy};
    
    async fn check() {
        // Create input with the email(s) to test
        let mut input = CheckEmailInput::new(vec!["someone@gmail.com".into()]);
    
        // Verify the email using async/await
        let result = check_email(&input).await;
    
        // result is a Vec<CheckEmailOutput>
        println!("{:?}", result);
    }
    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()]);
    
        // Verify this email, using async/await syntax.
        let result = check_email(&input).await;
    
        // `result` is a `Vec<CheckEmailOutput>`, where the CheckEmailOutput
        // struct contains all information about our email.
        println!("{:?}", result);
    }
  5. Configure Reacher Backend via Docker Environment Variables

    master

    You can configure Reacher by passing environment variables to the Docker container using the -e flag. Each configuration parameter in the TOML file has a corresponding environment variable prefixed with RCH__.

    Common backend configuration variables include:

    • RCH__BACKEND_NAME: Name to identify the backend.
    • RCH__HTTP_HOST: Host to bind the backend to.
    • RCH__HTTP_PORT: Port for the backend.
    • RCH__HELLO_NAME: Name used during the SMTP EHLO/HELO command (ideally matching the server's reverse DNS).
    • RCH__FROM_EMAIL: Email used during the SMTP MAIL FROM command.
    • RCH__SMTP_TIMEOUT: Timeout for each SMTP connection in seconds.
    • RCH__HEADER_SECRET: Shared secret required in the x-reacher-secret header of incoming requests.
    • RCH__SENTRY_DSN: Sentry DSN for error reporting.
    • RCH__WEBDRIVER_ADDR: Address of the Chrome WebDriver server for headless verifications.
  6. Use the check-if-email-exists CLI

    master

    The CLI allows you to check if an email address exists directly from your terminal without connecting to a backend.

    Basic Usage:

    check_if_email_exists <TO_EMAIL>

    Enable Debug Logs: To see detailed debug logs during execution, set the RUST_LOG environment variable:

    RUST_LOG=debug check_if_email_exists <TO_EMAIL>
  7. Use a Custom TOML Configuration File with Docker

    master

    Instead of passing individual environment variables, you can mount a complete backend_config.toml file into the container.

    It is recommended to also pass -e RUST_LOG=reacher=debug to see the final parsed configuration in the logs.

    docker run -e RUST_LOG=reacher=debug -v /path/to/local/backend_config.toml:./backend_config.toml -p 8080:8080 reacherhq/backend:beta
  8. Define routing rules for email providers

    master

    After defining your proxies, you can route specific email providers to specific proxies using routing rules. Rules are applied based on the MX host.

    Routing Variable Pattern:

    • RCH__OVERRIDES__{email-provider}__TYPE=smtp
    • RCH__OVERRIDES__{email-provider}__PROXY={your-proxy-id-lowercase}

    Supported {email-provider} values (must be uppercase):

    • GMAIL
    • HOTMAILB2B
    • HOTMAILB2C
    • PROOFPOINT
    • MIMECAST
    • YAHOO

    Important Notes:

    • {your-proxy-id-lowercase} must match the lowercase version of the ID you defined in the proxy list.
    • Any email that does not match an override rule will automatically use the default proxy.
  9. Scale Reacher using Pure Serverless Architecture

    master

    Deploy Reacher as a stateless function using serverless platforms like AWS Lambda or Google Cloud Functions.

    Benefits:

    • Infinite horizontal scaling.
    • No infrastructure management.

    Considerations:

    • Increased complexity in managing rate-limiting and proxy usage.
    • Potentially higher costs for large-scale, constant usage.
  10. Verify an email using the Reacher API

    master

    Integrate Reacher into your applications by using the REST API.

    1. Create an account at https://app.reacher.email to obtain a unique API token.
    2. Send a POST request to https://api.reacher.email/v0/check_email with your API token in the authorization header and the target email in a JSON body under the key to_email.
    curl -X POST \
        https://api.reacher.email/v0/check_email \
        -H 'content-type: application/json' \
          -H 'authorization: <YOUR_API_TOKEN>' \
          -d '{"to_email": "amaury@reacher.email"}'