Skip to main content

ipscanner/types/
email.rs

1use serde::{Deserialize, Serialize};
2
3/// Response of `POST /v1/email/check`.
4#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
5#[serde(default)]
6pub struct EmailCheck {
7    pub email: String,
8    /// `valid`, `invalid`, `risky` or `unknown`.
9    pub status: String,
10    /// `syntax`, `no_mx`, `null_mx`, `disposable`, `typo`, `role`, `dns_error` or `quota`. Null when valid.
11    pub reason: Option<String>,
12    /// The address with a webmail typo fixed, when there is one.
13    pub suggestion: Option<String>,
14    pub domain: String,
15    pub checks: EmailChecks,
16    /// Always `not_checked`: the mailbox itself is not probed.
17    pub mailbox: String,
18}
19
20/// The checks behind an email status.
21#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
22#[serde(default, rename_all = "camelCase")]
23pub struct EmailChecks {
24    pub syntax: bool,
25    /// Null when DNS was not asked or did not answer.
26    pub mx: Option<bool>,
27    pub disposable: bool,
28    pub role: bool,
29    pub free_provider: bool,
30}