pub struct CheckEmailInput {
Show 14 fields pub to_email: String, pub from_email: String, pub hello_name: String, pub proxy: Option<CheckEmailInputProxy>, pub smtp_port: u16, pub smtp_timeout: Option<Duration>, pub yahoo_use_api: bool, pub gmail_use_api: bool, pub microsoft365_use_api: bool, pub check_gravatar: bool, pub haveibeenpwned_api_key: Option<String>, pub retries: usize, pub smtp_security: SmtpSecurity, pub skipped_domains: Vec<String>,
}
Expand description

Builder pattern for the input argument into the main email_exists function.

Fields§

§to_email: String

The email to validate.

§from_email: String

Email to use in the MAIL FROM: SMTP command.

Defaults to “reacher.email@gmail.com”, which is an unused addressed owned by Reacher.

§hello_name: String

Name to use in the EHLO: SMTP command.

Defaults to “gmail.com” (note: “localhost” is not a FQDN).

§proxy: Option<CheckEmailInputProxy>

Perform the email verification via the specified SOCK5 proxy. The usage of a proxy is optional.

§smtp_port: u16

SMTP port to use for email validation. Generally, ports 25, 465, 587 and 2525 are used.

Defaults to 25.

§smtp_timeout: Option<Duration>

Add timeout for the SMTP verification step. Set to None if you don’t want to use a timeout.

Defaults to 12s (more than 10s, but when run twice less than 30s).

§yahoo_use_api: bool

For Yahoo email addresses, use Yahoo’s API instead of connecting directly to their SMTP servers.

Defaults to true.

§gmail_use_api: bool

For Gmail email addresses, use Gmail’s API instead of connecting directly to their SMTP servers.

Defaults to false.

§microsoft365_use_api: bool

For Microsoft 365 email addresses, use OneDrive’s API instead of connecting directly to their SMTP servers.

Defaults to false.

§check_gravatar: bool§haveibeenpwned_api_key: Option<String>

Check if a the email address is present in HaveIBeenPwned API.

§retries: usize

Number of retries of SMTP connections to do.

Defaults to 2 to avoid greylisting.

§smtp_security: SmtpSecurity

How to apply TLS to a SMTP client connection.

Defaults to Opportunistic.

§skipped_domains: Vec<String>

IMPORTANT: This is a beta feature, and might be completely removed, or moved somewhere else, before the next release.

List of domains to skip when doing an SMTP connection, because we know they return “unknown”. For each string in this list, we check if the MX record contains the string; if yes, we return an error saying the SMTP verification is skipped.

Related issue: https://github.com/reacherhq/check-if-email-exists/issues/937

Example

If you want to skip Zoho emails, it’s good enough to “.zoho.com.” to the list. This way it will skip all Zoho emails as their MX records show “mx{N}.zoho.com.”. Simply putting “zoho” might give false positives if you have an email provider like “mycustomzoho.com”.

Defaults to: [“”]

Implementations§

source§

impl CheckEmailInput

source

pub fn new(to_email: String) -> CheckEmailInput

Create a new CheckEmailInput.

source

pub fn from_email(&mut self, email: String) -> &mut CheckEmailInput

👎Deprecated since 0.8.24: Please use set_from_email instead

Set the email to use in the MAIL FROM: SMTP command. Defaults to user@example.org if not explicitly set.

source

pub fn set_from_email(&mut self, email: String) -> &mut CheckEmailInput

Set the email to use in the MAIL FROM: SMTP command. Defaults to user@example.org if not explicitly set.

source

pub fn hello_name(&mut self, name: String) -> &mut CheckEmailInput

👎Deprecated since 0.8.24: Please use set_hello_name instead

Set the name to use in the EHLO: SMTP command. Defaults to localhost if not explicitly set.

source

pub fn set_hello_name(&mut self, name: String) -> &mut CheckEmailInput

Set the name to use in the EHLO: SMTP command. Defaults to localhost if not explicitly set.

source

pub fn proxy( &mut self, proxy_host: String, proxy_port: u16 ) -> &mut CheckEmailInput

👎Deprecated since 0.8.24: Please use set_proxy instead

Use the specified SOCK5 proxy to perform email verification.

source

pub fn set_proxy(&mut self, proxy: CheckEmailInputProxy) -> &mut CheckEmailInput

Use the specified SOCK5 proxy to perform email verification.

source

pub fn set_retries(&mut self, retries: usize) -> &mut CheckEmailInput

Set the number of SMTP retries to do.

source

pub fn smtp_timeout(&mut self, duration: Duration) -> &mut CheckEmailInput

👎Deprecated since 0.8.24: Please use set_smtp_timeout instead

Add optional timeout for the SMTP verification step.

source

pub fn set_smtp_port(&mut self, port: u16) -> &mut CheckEmailInput

Change the SMTP port.

source

pub fn set_smtp_security( &mut self, smtp_security: SmtpSecurity ) -> &mut CheckEmailInput

Set the SMTP client security to use for TLS.

source

pub fn set_smtp_timeout( &mut self, duration: Option<Duration> ) -> &mut CheckEmailInput

Add optional timeout for the SMTP verification step. This is the timeout for each SMTP connection attempt, not for the whole email verification process.

source

pub fn yahoo_use_api(&mut self, use_api: bool) -> &mut CheckEmailInput

👎Deprecated since 0.8.24: Please use set_yahoo_use_api instead

Set whether to use Yahoo’s API or connecting directly to their SMTP servers. Defaults to true.

source

pub fn set_yahoo_use_api(&mut self, use_api: bool) -> &mut CheckEmailInput

Set whether to use Yahoo’s API or connecting directly to their SMTP servers. Defaults to true.

source

pub fn set_gmail_use_api(&mut self, use_api: bool) -> &mut CheckEmailInput

Set whether to use Gmail’s API or connecting directly to their SMTP servers. Defaults to false.

source

pub fn set_microsoft365_use_api( &mut self, use_api: bool ) -> &mut CheckEmailInput

Set whether to use Microsoft 365’s OneDrive API or connecting directly to their SMTP servers. Defaults to false.

source

pub fn set_check_gravatar( &mut self, check_gravatar: bool ) -> &mut CheckEmailInput

Whether to check if a gravatar image is existing for the given email. Defaults to false.

source

pub fn set_haveibeenpwned_api_key( &mut self, api_key: Option<String> ) -> &mut CheckEmailInput

Whether to haveibeenpwned’ API for the given email check only if the api_key is set

source

pub fn set_skipped_domains( &mut self, domains: Vec<String> ) -> &mut CheckEmailInput

IMPORTANT: This is a beta feature, and might be completely removed, or moved somewhere else, before the next release.

List of domains to skip when doing an SMTP connection, because we know they return “unknown”.

Trait Implementations§

source§

impl Clone for CheckEmailInput

source§

fn clone(&self) -> CheckEmailInput

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for CheckEmailInput

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for CheckEmailInput

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for CheckEmailInputwhere CheckEmailInput: Default,

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Serialize for CheckEmailInput

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,