Struct OutlookMailer

Source
pub struct OutlookMailer { /* private fields */ }
Expand description

An Outlook mailer client, implementing the async_mailer_core::Mailer and async_mailer_core::DynMailer traits to be used as generic mailer or runtime-pluggable trait object.

Sends mail authenticated by OAuth2 client credentials grant via the Microsoft Graph API.

Implementations§

Source§

impl OutlookMailer

Source

pub async fn new( tenant: String, app_guid: String, secret: SecretBox<str>, ) -> Result<OutlookMailer, OutlookMailerError>

Create a new Outlook mailer client.

§Errors

Returns an OutlookMailerError::RetrieveAccessToken error when the attempt to retrieve an access token from the Microsoft Identity Service fails:

Source

pub async fn new_box( tenant: String, app_guid: String, secret: SecretBox<str>, ) -> Result<Box<dyn DynMailer>, OutlookMailerError>

Create a new Outlook mailer client as dynamic async_mailer::BoxMailer.

§Errors

Returns an OutlookMailerError::RetrieveAccessToken error when the attempt to retrieve an access token from the Microsoft Identity Service fails:

Source

pub async fn new_arc( tenant: String, app_guid: String, secret: SecretBox<str>, ) -> Result<Arc<dyn DynMailer>, OutlookMailerError>

Create a new Outlook mailer client as dynamic async_mailer::ArcMailer.

§Errors

Returns an OutlookMailerError::RetrieveAccessToken error when the attempt to retrieve an access token from the Microsoft Identity Service fails:

Trait Implementations§

Source§

impl Clone for OutlookMailer

Source§

fn clone(&self) -> OutlookMailer

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for OutlookMailer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl DynMailer for OutlookMailer

Source§

fn send_mail<'life0, 'life1, 'async_trait>( &'life0 self, message: Message<'life1>, ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Sync + Send>>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, OutlookMailer: 'async_trait,

Send the prepared MIME message via the Microsoft Graph API. Dynamically typed DynMailer implementation for trait object invocation via vtable dispatch.

§Errors

Returns a boxed, type-erased OutlookMailerError::SendMailRequest error if sending the mailing request to the Microsoft Graph API fails.

Returns a boxed, type-erased OutlookMailerError::SendMailResponse error if the Microsoft Graph API responds with a non-success HTTP status code.

Returns a boxed, type-erased OutlookMailerError::SendMailResponseBody error if the Microsoft Graph API reponse body cannot be received. (Crate feature tracing only: The response body is only received for logging.)

Source§

impl Mailer for OutlookMailer

Source§

fn send_mail<'life0, 'life1, 'async_trait>( &'life0 self, message: Message<'life1>, ) -> Pin<Box<dyn Future<Output = Result<(), <OutlookMailer as Mailer>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, OutlookMailer: 'async_trait,

Send the prepared MIME message via the Microsoft Graph API. Statically typed Mailer implementation for direct or generic (impl Mailer / <M: Mailer>) invocation without vtable dispatch.

§Errors

Returns an OutlookMailerError::SendMailRequest error if sending the mailing request to the Microsoft Graph API fails.

Returns an OutlookMailerError::SendMailResponse error if the Microsoft Graph API responds with a non-success HTTP status code.

Returns an OutlookMailerError::SendMailResponseBody error if the Microsoft Graph API reponse body cannot be received. (Crate feature tracing only: The response body is only received for logging.)

Source§

type Error = OutlookMailerError

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,