1#![cfg(all(feature = "email-check", feature = "native-tls"))]
2
3use check_if_email_exists::{CheckEmailOutput, Reachable};
4
5pub(crate) fn error_from_output(o: &CheckEmailOutput) -> String {
8 if let Err(_e) = o.misc.as_ref() {
9 return "Error occurred connecting to this email server via SMTP".to_string();
10 } else if let Err(e) = &o.smtp {
11 return format!("{e:?}");
12 } else if let Err(e) = &o.mx {
13 return format!("{e:?}");
14 }
15 match &o.is_reachable {
16 Reachable::Safe => "Safe: The email is safe to send",
17 Reachable::Risky => "Risky: The email address appears to exist, but has quality issues that may result in low engagement or a bounce",
18 Reachable::Invalid => "Invalid: Email doesn't exist or is syntactically incorrect",
19 Reachable::Unknown => "Unknown: We're unable to get a valid response from the recipient's email server."
20 }.to_string()
21}