pub struct EmailNotifier<T: AsyncTransport + Send + Sync> { /* private fields */ }
Expand description
Implementation of email notifications via SMTP
Implementations§
Source§impl<T: AsyncTransport + Send + Sync> EmailNotifier<T>
impl<T: AsyncTransport + Send + Sync> EmailNotifier<T>
Sourcepub fn with_transport(
email_content: EmailContent,
transport: T,
retry_policy: RetryConfig,
) -> Self
pub fn with_transport( email_content: EmailContent, transport: T, retry_policy: RetryConfig, ) -> Self
Source§impl EmailNotifier<AsyncSmtpTransport<Tokio1Executor>>
impl EmailNotifier<AsyncSmtpTransport<Tokio1Executor>>
Sourcepub fn new(
smtp_client: Arc<AsyncSmtpTransport<Tokio1Executor>>,
email_content: EmailContent,
retry_policy: RetryConfig,
) -> Result<Self, NotificationError>
pub fn new( smtp_client: Arc<AsyncSmtpTransport<Tokio1Executor>>, email_content: EmailContent, retry_policy: RetryConfig, ) -> Result<Self, NotificationError>
Sourcepub fn body_template(&self) -> &str
pub fn body_template(&self) -> &str
Returns the body template of the email.
Sourcepub fn format_message(
body_template: &str,
variables: &HashMap<String, String>,
) -> String
pub fn format_message( body_template: &str, variables: &HashMap<String, String>, ) -> String
Formats a message by substituting variables in the template and converts it to HTML Method is static because property-based tests do not have tokio runtime available, which is required for AsyncSmtpTransport
§Arguments
variables
- Map of variable names to values
§Returns
String
- Formatted message with variables replaced and converted to HTML
Sourcepub fn markdown_to_html(md: &str) -> String
pub fn markdown_to_html(md: &str) -> String
Convert a Markdown string into HTML
Sourcepub fn from_config(
config: &TriggerTypeConfig,
smtp_client: Arc<AsyncSmtpTransport<Tokio1Executor>>,
) -> Result<Self, NotificationError>
pub fn from_config( config: &TriggerTypeConfig, smtp_client: Arc<AsyncSmtpTransport<Tokio1Executor>>, ) -> Result<Self, NotificationError>
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for EmailNotifier<T>
impl<T> RefUnwindSafe for EmailNotifier<T>where
T: RefUnwindSafe,
impl<T> Send for EmailNotifier<T>
impl<T> Sync for EmailNotifier<T>
impl<T> Unpin for EmailNotifier<T>
impl<T> UnwindSafe for EmailNotifier<T>where
T: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Chain<T> for T
impl<T> Chain<T> for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more