Check if an email address exists without sending any email, written in Rust. Comes with a ⚙️ HTTP backend.
Rust emailemail-validationemail-validation-apiemail-verificationemail-verification-apiemail-verifierhacktoberfest
feat(backend): Support RCH_SMTP_TIMEOUT (#1407)
Amauryb9bda4049540
diff --git a/backend/README.md b/backend/README.mdindex 8c246e6a..7def3e3a 100644--- a/backend/README.md+++ b/backend/README.md@@ -61,6 +61,7 @@ These are the environment variables used to configure the HTTP server. To pass t| `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. | [email protected] || `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 Documentationdiff --git a/backend/src/check.rs b/backend/src/check.rsindex dcd7cfd1..d8dacff1 100644--- a/backend/src/check.rs+++ b/backend/src/check.rs@@ -16,7 +16,7 @@//! This file contains shared logic for checking one email.-use std::env;+use std::{env, time::Duration};use check_if_email_exists::{check_email as ciee_check_email, CheckEmailInput, CheckEmailOutput};use warp::Filter;@@ -30,12 +30,18 @@ pub async fn check_email(input: CheckEmailInput) -> CheckEmailOutput {env::var("RCH_FROM_EMAIL").unwrap_or_else(|_| CheckEmailInput::default().from_email);let hello_name =env::var("RCH_HELLO_NAME").unwrap_or_else(|_| CheckEmailInput::default().hello_name);+ let smtp_timeout = env::var("RCH_SMTP_TIMEOUT")+ .ok()+ .and_then(|s| s.parse::<u64>().ok())+ .map(Duration::from_secs)+ .or_else(|| CheckEmailInput::default().smtp_timeout);let input = CheckEmailInput {// If we want to override core check-if-email-exists's default values// for CheckEmailInput for the backend, we do it here.from_email,hello_name,+ smtp_timeout,..input};