Skip to content

Commit

Permalink
feat(core)!: Update async-smtp to 0.9 (#1520)
Browse files Browse the repository at this point in the history
BREAKING CHANGE:

The `smtp_security` field has been removed from the /check_email request.
  • Loading branch information
amaury1093 authored Dec 4, 2024
1 parent 093525d commit 297ce4f
Show file tree
Hide file tree
Showing 14 changed files with 300 additions and 302 deletions.
48 changes: 5 additions & 43 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ publish = false

[dependencies]
anyhow = "1.0"
async-smtp = "0.6"
async-smtp = { version = "0.9.1", features = ["runtime-tokio"] }
check-if-email-exists = { path = "../core", features = ["sentry"] }
config = "0.14"
csv = "1.3.0"
Expand Down
4 changes: 3 additions & 1 deletion backend/src/http/v0/check_email/post.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ impl CheckEmailRequest {
.or_else(|| config.proxy.as_ref())
.cloned(),
smtp_timeout: config.smtp_timeout.map(Duration::from_secs),
smtp_port: self.smtp_port.unwrap_or_default(),
smtp_port: self
.smtp_port
.unwrap_or_else(|| CheckEmailInput::default().smtp_port),
sentry_dsn: config.sentry_dsn.clone(),
..Default::default()
}
Expand Down
10 changes: 4 additions & 6 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ readme = "../README.md"
repository = "https://github.com/reacherhq/check-if-email-exists"

[dependencies]
async-native-tls = { version = "0.4", default-features = false }
anyhow = "1.0"
async-recursion = "1.0.5"
async-smtp = { version = "0.6.0", features = ["socks5"] }
async-smtp = { version = "0.9.1", features = ["runtime-tokio"] }
chrono = { version = "0.4.31", features = ["serde"] }
config = "0.14"
derive_builder = "0.20"
fast-socks5 = "0.9"
fantoccini = { version = "0.21.2" }
futures = { version = "0.3.30" }
fast-socks5 = "0.9.2"
hickory-proto = "0.24.0"
hickory-resolver = "0.24.0"
levenshtein = "1.0.5"
Expand All @@ -37,7 +37,5 @@ sentry = { version = "0.23", optional = true }
serde = { version = "1.0.214", features = ["derive"] }
serde_json = "1.0.133"
thiserror = "1.0"
tokio = { version = "1.40.0", features = ["rt-multi-thread", "macros"] }
tracing = "0.1.40"

[dev-dependencies]
tokio = { version = "1.40.0" }
8 changes: 4 additions & 4 deletions core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
//! - Email deliverability: Is an email sent to this address deliverable?
//! - Syntax validation. Is the address syntactically valid?
//! - DNS records validation. Does the domain of the email address have valid
//! MX DNS records?
//! MX DNS records?
//! - Disposable email address (DEA) validation. Is the address provided by a
//! known disposable email address provider?
//! known disposable email address provider?
//! - SMTP server validation. Can the mail exchanger of the email address
//! domain be contacted successfully?
//! domain be contacted successfully?
//! - Mailbox disabled. Has this email address been disabled by the email
//! provider?
//! provider?
//! - Full inbox. Is the inbox of this mailbox full?
//! - Catch-all address. Is this email address a catch-all address?
//!
Expand Down
18 changes: 18 additions & 0 deletions core/src/rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,21 @@ pub fn has_rule(domain: &str, host: &str, rule: &Rule) -> bool {
|| does_mx_have_rule(host, rule)
|| does_mx_suffix_have_rule(host, rule)
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn should_skip_catch_all() {
assert_eq!(
true,
has_rule("gmail.com", "alt4.aspmx.l.google.com.", &Rule::SkipCatchAll)
);

assert_eq!(
true,
has_rule("domain.com", ".antispamcloud.com.", &Rule::SkipCatchAll)
)
}
}
Loading

0 comments on commit 297ce4f

Please sign in to comment.