Skip to content

Check if an email address exists without sending any email, written in Rust. Comes with a ⚙️ HTTP backend.

fix: Fix is_reachable with wrong syntax (#352)

Amaury Martinyb0f02090edc0
diff --git a/core/src/lib.rs b/core/src/lib.rs
index d5310410..64287df8 100644
--- a/core/src/lib.rs
+++ b/core/src/lib.rs
@@ -113,6 +113,7 @@ async fn check_single_email(input: CheckEmailInput) -> CheckEmailOutput {
if !my_syntax.is_valid_syntax {
return CheckEmailOutput {
input: to_email.to_string(),
+ is_reachable: Reachable::Invalid,
syntax: my_syntax,
..Default::default()
};
@@ -128,7 +129,7 @@ async fn check_single_email(input: CheckEmailInput) -> CheckEmailOutput {
Ok(m) => m,
e => {
// This happens when there's an internal error while checking MX
- // records.
+ // records. Should happen fairly rarely.
return CheckEmailOutput {
input: to_email.to_string(),
is_reachable: Reachable::Unknown,
diff --git a/test_suite/src/lib.rs b/test_suite/src/lib.rs
index 63570c9c..e230da91 100644
--- a/test_suite/src/lib.rs
+++ b/test_suite/src/lib.rs
@@ -51,6 +51,7 @@ mod tests {
// For the input,misc,smtp,syntax fields, we match exact JSON.
assert_eq!(expected.get("input"), actual.get("input"),);
+ assert_eq!(expected.get("is_reachable"), actual.get("is_reachable"),);
assert_eq!(expected.get("misc"), actual.get("misc"),);
assert_eq!(expected.get("smtp"), actual.get("smtp"),);
assert_eq!(expected.get("syntax"), actual.get("syntax"),);