Skip to content

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

feat: Use opportunistic STARTTLS by default (#1079)

Amaury54911f0a8ec5
diff --git a/core/src/smtp/parser.rs b/core/src/smtp/parser.rs
index 7b19e2a4..040d05e5 100644
--- a/core/src/smtp/parser.rs
+++ b/core/src/smtp/parser.rs
@@ -189,3 +189,17 @@ pub fn is_err_needs_rdns(e: &SmtpError) -> bool {
// You dont seem to have a reverse dns entry. Come back later. You are greylisted for 20 minutes. See http://www.fsf.org/about/systems/greylisting
first_line.contains("reverse dns entry")
}
+
+#[cfg(test)]
+mod tests {
+
+ #[test]
+ fn is_invalid_works() {
+ use super::is_invalid;
+
+ assert_eq!(
+ is_invalid("554 5.7.1 <mta.voipdir.net[]>: Client host rejected: Access denied"),
+ false
+ );
+ }
+}
diff --git a/core/src/syntax.rs b/core/src/syntax.rs
index 685fd7e3..8359c50e 100644
--- a/core/src/syntax.rs
+++ b/core/src/syntax.rs
@@ -19,7 +19,7 @@ use serde::{Deserialize, Serialize};
use std::str::FromStr;
/// Syntax information after parsing an email address
-#[derive(Debug, PartialEq, Deserialize, Serialize)]
+#[derive(Debug, Eq, PartialEq, Deserialize, Serialize)]
pub struct SyntaxDetails {
/// The email address as a async_smtp `EmailAddress`. It will be `None` if
/// the email address is ill-formed.
diff --git a/core/src/util/input_output.rs b/core/src/util/input_output.rs
index a8c547b5..00bcf7df 100644
--- a/core/src/util/input_output.rs
+++ b/core/src/util/input_output.rs
@@ -108,7 +108,7 @@ impl Default for CheckEmailInput {
hello_name: "localhost".into(),
proxy: None,
smtp_port: 25,
- smtp_security: SmtpSecurity::None,
+ smtp_security: SmtpSecurity::Opportunistic,
smtp_timeout: None,
yahoo_use_api: true,
retries: 2,
@@ -221,7 +221,7 @@ impl CheckEmailInput {
/// An enum to describe how confident we are that the recipient address is
/// real.
-#[derive(Debug, PartialEq, Deserialize, Serialize)]
+#[derive(Debug, Eq, PartialEq, Deserialize, Serialize)]
#[serde(rename_all = "lowercase")]
pub enum Reachable {
/// The email is safe to send.