Struct check_if_email_exists::CheckEmailInput
source · 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
impl CheckEmailInput
sourcepub fn new(to_email: String) -> CheckEmailInput
pub fn new(to_email: String) -> CheckEmailInput
Create a new CheckEmailInput.
sourcepub fn from_email(&mut self, email: String) -> &mut CheckEmailInput
👎Deprecated since 0.8.24: Please use set_from_email instead
pub fn 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.
sourcepub fn set_from_email(&mut self, email: String) -> &mut CheckEmailInput
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.
sourcepub fn hello_name(&mut self, name: String) -> &mut CheckEmailInput
👎Deprecated since 0.8.24: Please use set_hello_name instead
pub fn 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.
sourcepub fn set_hello_name(&mut self, name: String) -> &mut CheckEmailInput
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.
sourcepub fn proxy(
&mut self,
proxy_host: String,
proxy_port: u16
) -> &mut CheckEmailInput
👎Deprecated since 0.8.24: Please use set_proxy instead
pub fn proxy( &mut self, proxy_host: String, proxy_port: u16 ) -> &mut CheckEmailInput
Use the specified SOCK5 proxy to perform email verification.
sourcepub fn set_proxy(&mut self, proxy: CheckEmailInputProxy) -> &mut CheckEmailInput
pub fn set_proxy(&mut self, proxy: CheckEmailInputProxy) -> &mut CheckEmailInput
Use the specified SOCK5 proxy to perform email verification.
sourcepub fn set_retries(&mut self, retries: usize) -> &mut CheckEmailInput
pub fn set_retries(&mut self, retries: usize) -> &mut CheckEmailInput
Set the number of SMTP retries to do.
sourcepub fn smtp_timeout(&mut self, duration: Duration) -> &mut CheckEmailInput
👎Deprecated since 0.8.24: Please use set_smtp_timeout instead
pub fn smtp_timeout(&mut self, duration: Duration) -> &mut CheckEmailInput
Add optional timeout for the SMTP verification step.
sourcepub fn set_smtp_port(&mut self, port: u16) -> &mut CheckEmailInput
pub fn set_smtp_port(&mut self, port: u16) -> &mut CheckEmailInput
Change the SMTP port.
sourcepub fn set_smtp_security(
&mut self,
smtp_security: SmtpSecurity
) -> &mut CheckEmailInput
pub fn set_smtp_security( &mut self, smtp_security: SmtpSecurity ) -> &mut CheckEmailInput
Set the SMTP client security to use for TLS.
sourcepub fn set_smtp_timeout(
&mut self,
duration: Option<Duration>
) -> &mut CheckEmailInput
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.
sourcepub fn yahoo_use_api(&mut self, use_api: bool) -> &mut CheckEmailInput
👎Deprecated since 0.8.24: Please use set_yahoo_use_api instead
pub fn 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.
sourcepub fn set_yahoo_use_api(&mut self, use_api: bool) -> &mut CheckEmailInput
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.
sourcepub fn set_gmail_use_api(&mut self, use_api: bool) -> &mut CheckEmailInput
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.
sourcepub fn set_microsoft365_use_api(
&mut self,
use_api: bool
) -> &mut CheckEmailInput
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.
sourcepub fn set_check_gravatar(
&mut self,
check_gravatar: bool
) -> &mut CheckEmailInput
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.
sourcepub fn set_haveibeenpwned_api_key(
&mut self,
api_key: Option<String>
) -> &mut CheckEmailInput
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
sourcepub fn set_skipped_domains(
&mut self,
domains: Vec<String>
) -> &mut CheckEmailInput
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
impl Clone for CheckEmailInput
source§fn clone(&self) -> CheckEmailInput
fn clone(&self) -> CheckEmailInput
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more