Skip to content

Commit

Permalink
fix(core): Remove antispam check
Browse files Browse the repository at this point in the history
  • Loading branch information
amaury1093 committed Oct 7, 2023
1 parent c40a46c commit 2ca1cca
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
5 changes: 3 additions & 2 deletions core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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
Expand All @@ -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::<Vec<&MX>>();
mx_records.sort_by_key(|a| a.preference());
let host = if mx_records.len() >= 3 {
Expand Down
10 changes: 0 additions & 10 deletions core/src/mx/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -96,12 +95,3 @@ pub async fn check_mx(syntax: &SyntaxDetails) -> Result<MxDetails, MxError> {
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")
}

0 comments on commit 2ca1cca

Please sign in to comment.