From 06f18edf7aee5640b3725feedfa7b7f213da83a8 Mon Sep 17 00:00:00 2001 From: Amaury <1293565+amaury1729@users.noreply.github.com> Date: Sat, 7 Oct 2023 21:38:31 +0200 Subject: [PATCH] fix(core): Remove antispam check (#1337) --- core/src/lib.rs | 5 +++-- core/src/mx/mod.rs | 10 ---------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/core/src/lib.rs b/core/src/lib.rs index ae1359e67..e0748d62d 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -70,7 +70,7 @@ pub mod syntax; mod util; use misc::{check_misc, MiscDetails}; -use mx::{check_mx, is_antispam_mx}; +use mx::check_mx; use rand::Rng; use smtp::{check_smtp, SmtpDetails, SmtpError}; use syntax::{check_syntax, get_similar_mail_provider}; @@ -196,6 +196,8 @@ pub async fn check_email(input: &CheckEmailInput) -> CheckEmailOutput { // beginning or end of the list (sorted by priority). Instead, we choose a // random one in the middle of the list. // + // See here for explanation: https://cwiki.apache.org/confluence/display/SPAMASSASSIN/OtherTricks + // // If anyone has a better algorithm, let me know by creating an issue on // Github. // ref: https://github.com/reacherhq/check-if-email-exists/issues/1049 @@ -204,7 +206,6 @@ pub async fn check_email(input: &CheckEmailInput) -> CheckEmailOutput { .as_ref() .expect("If lookup is error, we already returned. qed.") .iter() - .filter(|host| !is_antispam_mx(host.exchange())) .collect::>(); mx_records.sort_by_key(|a| a.preference()); let host = if mx_records.len() >= 3 { diff --git a/core/src/mx/mod.rs b/core/src/mx/mod.rs index 0a52afe12..abe83a3a9 100644 --- a/core/src/mx/mod.rs +++ b/core/src/mx/mod.rs @@ -19,7 +19,6 @@ use crate::util::ser_with_display::ser_with_display; use async_std_resolver::{lookup::MxLookup, resolver_from_system_conf, ResolveError}; use serde::{ser::SerializeMap, Serialize, Serializer}; use std::io::Error; -use trust_dns_proto::rr::Name; /// Details about the MX lookup. #[derive(Debug)] @@ -96,12 +95,3 @@ pub async fn check_mx(syntax: &SyntaxDetails) -> Result { Err(err) => Ok(MxDetails { lookup: Err(err) }), } } - -// is_antispam_mx checks if the MX record is an antispam MX record. -pub fn is_antispam_mx(host: &Name) -> bool { - let host = host.to_string(); - // filter20.antispamcloud.com. (on @computan.net) - host.contains("antispamcloud.com") - // mx.spamexperts.com (see https://documentation.n-able.com/spamexperts/userguide/Content/B_Admin%20Level/domains/mx-records.htm) - || host.contains("spamexperts.com") -}