Skip to content

Latest commit

 

History

History
108 lines (81 loc) · 7.17 KB

README.md

File metadata and controls

108 lines (81 loc) · 7.17 KB

Docker Actions Status



reacher

⚙️ Reacher Backend

REST Server for Reacher Email Verification API: https://reacher.email.



This crate holds the backend for Reacher. The backend is a HTTP server with the following components:

Get Started

The Docker image is hosted on Docker Hub: https://hub.docker.com/r/reacherhq/backend.

To run it, run the following command:

docker run -p 8080:8080 reacherhq/backend:latest

Then send a POST http://localhost:8080/v0/check_email request with the following body:

{
    "to_email": "someone@gmail.com",
    "from_email": "my@my-server.com", // (optional) email to use in the `FROM` SMTP command, defaults to "user@example.org"
    "hello_name": "my-server.com",    // (optional) name to use in the `EHLO` SMTP command, defaults to "localhost"
    "proxy": {                        // (optional) SOCK5 proxy to run the verification through, default is empty
        "host": "my-proxy.io",
        "port": 1080,
        "username": "me",             // (optional) Proxy username
        "password": "pass"            // (optional) Proxy password
    },
    "smtp_port": 587                  // (optional) SMTP port to do the email verification, defaults to 25
}

Configuration

These are the environment variables used to configure the HTTP server. To pass them to the Docker container, use the -e {ENV_VAR}={VALUE} flag.

Env Var Required? Description Default
RUST_LOG No One of trace,debug,warn,error,info. 💡 PRO TIP: RUST_LOG=debug is very handful for debugging purposes. not defined
RCH_HTTP_HOST No The host name to bind the HTTP server to. 127.0.0.1
PORT No The port to bind the HTTP server to, often populated by the cloud provider. 8080
RCH_SENTRY_DSN No If set, bug reports will be sent to this Sentry DSN. not defined
RCH_HEADER_SECRET No If set, then all HTTP requests must have the x-reacher-secret header set to this value. This is used to protect the backend against public unwanted HTTP requests. undefined
RCH_FROM_EMAIL No Email to use in the <MAIL FROM:> SMTP step. Can be overwritten by each API request's from_email field. reacher.email@gmail.com
RCH_HELLO_NAME No Name to use in the <EHLO> SMTP step. Can be overwritten by each API request's hello_name field. gmail.com
RCH_SMTP_TIMEOUT No Timeout for each SMTP connection. 45s
RCH_WEBDRIVER_ADDR No Set to a running WebDriver process endpoint (e.g. http://localhost:9515) to use a headless navigator to password recovery pages to check Yahoo and Hotmail/Outlook addresses. We recommend chromedriver as it allows parallel requests. not defined

REST API Documentation

Read docs on https://help.reacher.email/rest-api-documentation.

The API exposes the following endpoint: POST /v0/check_email expecting the following body:

{
    "to_email": "someone@gmail.com",
    "from_email": "my@my-server.com", // (optional) email to use in the `FROM` SMTP command, defaults to "user@example.org"
    "hello_name": "my-server.com",    // (optional) name to use in the `EHLO` SMTP command, defaults to "localhost"
    "proxy": {                        // (optional) SOCK5 proxy to run the verification through, default is empty
        "host": "my-proxy.io",
        "port": 1080,
        "username": "me",             // (optional) Proxy username
        "password": "pass"            // (optional) Proxy password
    },
    "smtp_port": 587                  // (optional) SMTP port to do the email verification, defaults to 25
}

For example, you can send the following curl request:

curl -X POST \
    -H'Content-Type: application/json' \
    -d'{"to_email":"someone@gmail.com"}' \
    http://localhost:8080/v0/check_email

Also check the OpenAPI documentation.

Build From Source

You can build the backend from source to generate a binary, and run the server locally on your machine. First, install Rust; you'll need Rust 1.37.0 or later. Make sure openssl is installed too. Then, run the following commands:

# Download the code
$ git clone https://github.com/reacherhq/check-if-email-exists
$ cd check-if-email-exists

# Build the backend binary in release mode (more performant).
$ cargo build --release --bin reacher_backend

# Run the binary with some useful logs.
$ RUST_LOG=info ./target/release/reacher_backend

The server will then be listening on http://127.0.0.1:8080.