pub async fn send(&self, mail: &Message) -> SendgridResult<Response> {
        let headers = self.get_headers()?;

        let resp = self
            .client
            .post(V3_API_URL)
            .headers(headers)
            .body(mail.gen_json())
            .send()
            .await?;

        if let Err(_) = resp.error_for_status_ref() {
            return Err(RequestNotSuccessful::new(resp.status(), resp.text().await?).into());
        }

        Ok(resp)
    }
/// 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<Response> {
        let headers = self.get_headers()?;
        let resp = self
            .client
            .post(V3_API_URL)
            .headers(headers)
            .body(mail.gen_json())
            .send()
            .await?;
        if let Err(_) = resp.error_for_status_ref() {
            return Err(RequestNotSuccessful::new(resp.status(), resp.text().await?).into());
        }
        Ok(resp)
    }
pub async fn send ( & self , mail : & Message ) -> SendgridResult < Response > { let headers = self . get_headers ( ) ? ; let resp = self . client . post ( V3_API_URL ) . headers ( headers ) . body ( mail . gen_json ( ) ) . send ( ) . await ? ; if let Err ( _ ) = resp . error_for_status_ref ( ) { return Err ( RequestNotSuccessful :: new ( resp . status ( ) , resp . text ( ) . await ? ) . into ( ) ) ; } Ok ( resp ) }
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