Skip to content

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

fix: Lowercase the error string before matching (#321)

Amaury Martinyd983b2fe960e
diff --git a/README.md b/README.md
index a1c91d54..08d91fa6 100644
--- a/README.md
+++ b/README.md
@@ -177,6 +177,7 @@ The output will be a JSON with the below format, the fields should be self-expla
"is_disposable": false
},
"mx": {
+ "accepts_mail": true,
"records": [
"alt3.gmail-smtp-in.l.google.com.",
"gmail-smtp-in.l.google.com.",
@@ -186,13 +187,13 @@ The output will be a JSON with the below format, the fields should be self-expla
]
},
"smtp": {
+ "can_connect_smtp": true,
"has_full_inbox": false,
"is_catch_all": false,
"is_deliverable": false,
"is_disabled": true
},
"syntax": {
- "address": "[email protected]",
"domain": "gmail.com",
"is_valid_syntax": true,
"username": "someone"
diff --git a/core/src/smtp.rs b/core/src/smtp.rs
index d2001425..80a3d326 100644
--- a/core/src/smtp.rs
+++ b/core/src/smtp.rs
@@ -185,9 +185,9 @@ async fn email_deliverable(
))),
},
Err(err) => {
- let err_string = err.to_string();
- // Don't return an error if the error contains anything about the
- // address being undeliverable.
+ // We cast to lowercase, because our matched strings below are all
+ // lowercase.
+ let err_string = err.to_string().to_lowercase();
// Check if the email account has been disabled or blocked.
// e.g. "The email account that you tried to reach is disabled. Learn more at https://support.google.com/mail/?p=DisabledUser"
@@ -223,6 +223,7 @@ async fn email_deliverable(
|| err_string.contains("undeliverable")
|| err_string.contains("user unknown")
|| err_string.contains("user not found")
+ || err_string.contains("no such user")
{
return Ok(Deliverability {
has_full_inbox: false,