pub async fn send(&self, mail: &Message) -> SendgridResult<reqwest::Response> {
        use reqwest::Client;

        let headers = self.get_headers()?;

        let res = Client::new()
            .post(V3_API_URL)
            .headers(headers)
            .body(mail.gen_json())
            .send()
            .await
            .map_err(|err| SendgridError::from(err))?;
        if !res.status().is_success() {
            Err(SendgridError::RequestNotSuccessful(res.status()))
        } else {
            Ok(res)
        }
    }
/// Send a V3 message and return the HTTP response or an error.
Send a V3 message and return the HTTP response or an error.
Send a V3 message and return the HTTP response or an error .
pub async fn send(&self, mail: &Message) -> SendgridResult<reqwest::Response> {
        use reqwest::Client;
        let headers = self.get_headers()?;
        let res = Client::new()
            .post(V3_API_URL)
            .headers(headers)
            .body(mail.gen_json())
            .send()
            .await
            .map_err(|err| SendgridError::from(err))?;
        if !res.status().is_success() {
            Err(SendgridError::RequestNotSuccessful(res.status()))
        } else {
            Ok(res)
        }
    }
pub async fn send ( & self , mail : & Message ) -> SendgridResult < reqwest :: Response > { use reqwest :: Client ; let headers = self . get_headers ( ) ? ; let res = Client :: new ( ) . post ( V3_API_URL ) . headers ( headers ) . body ( mail . gen_json ( ) ) . send ( ) . await . map_err ( | err | SendgridError :: from ( err ) ) ? ; if ! res . status ( ) . is_success ( ) { Err ( SendgridError :: RequestNotSuccessful ( res . status ( ) ) ) } else { Ok ( res ) } }
Send a V3 message and return the HTTP response or an error.
Send a V3 message and return the HTTP response or an error .
&self
mail
&Message
&self
mail
&Message