ipscanner/resources/email.rs
1use serde_json::json;
2
3use crate::types::EmailCheck;
4use crate::{Client, Error};
5
6/// Email address checks. Get one with [`Client::email`].
7#[derive(Debug, Clone, Copy)]
8pub struct Email<'a> {
9 client: &'a Client,
10}
11
12impl<'a> Email<'a> {
13 pub(crate) fn new(client: &'a Client) -> Self {
14 Email { client }
15 }
16
17 /// Checks one address: syntax, throwaway domains, mail servers, typos and role addresses. One request.
18 pub async fn check(&self, email: &str) -> Result<EmailCheck, Error> {
19 self.client
20 .post("/email/check", &json!({ "email": email }))
21 .await
22 }
23}