pub struct EmailService { /* private fields */ }Expand description
Email service
Implementations§
Source§impl EmailService
impl EmailService
Sourcepub fn new(config: EmailConfig) -> Result<Self>
pub fn new(config: EmailConfig) -> Result<Self>
Sourcepub fn from_env() -> Result<Self>
pub fn from_env() -> Result<Self>
Create email service from environment variables
§Errors
Returns an error if the HTTP client cannot be created
Sourcepub async fn send(&self, message: EmailMessage) -> Result<()>
pub async fn send(&self, message: EmailMessage) -> Result<()>
Send an email
Sourcepub fn generate_welcome_email(username: &str, email: &str) -> EmailMessage
pub fn generate_welcome_email(username: &str, email: &str) -> EmailMessage
Generate welcome email content
Sourcepub fn generate_security_alert_email(
username: &str,
email: &str,
headline: &str,
detail: &str,
) -> EmailMessage
pub fn generate_security_alert_email( username: &str, email: &str, headline: &str, detail: &str, ) -> EmailMessage
Generate a security-alert email for an account-level event (password
change, 2FA enabled/disabled, etc). Gated by users.security_alerts
at the call site.
Sourcepub fn generate_subscription_confirmation(
username: &str,
email: &str,
plan: &str,
amount: Option<f64>,
period_end: Option<DateTime<Utc>>,
) -> EmailMessage
pub fn generate_subscription_confirmation( username: &str, email: &str, plan: &str, amount: Option<f64>, period_end: Option<DateTime<Utc>>, ) -> EmailMessage
Generate subscription confirmation email
Sourcepub fn generate_payment_failed(
username: &str,
email: &str,
plan: &str,
amount: f64,
retry_date: Option<DateTime<Utc>>,
) -> EmailMessage
pub fn generate_payment_failed( username: &str, email: &str, plan: &str, amount: f64, retry_date: Option<DateTime<Utc>>, ) -> EmailMessage
Generate payment failed email
Sourcepub fn generate_subscription_canceled(
username: &str,
email: &str,
plan: &str,
access_until: Option<DateTime<Utc>>,
) -> EmailMessage
pub fn generate_subscription_canceled( username: &str, email: &str, plan: &str, access_until: Option<DateTime<Utc>>, ) -> EmailMessage
Generate subscription canceled email
Sourcepub fn generate_usage_threshold_warning(
username: &str,
email: &str,
metric_label: &str,
plan: &str,
used_pretty: &str,
limit_pretty: &str,
threshold_pct: u16,
) -> EmailMessage
pub fn generate_usage_threshold_warning( username: &str, email: &str, metric_label: &str, plan: &str, used_pretty: &str, limit_pretty: &str, threshold_pct: u16, ) -> EmailMessage
Generate usage-threshold warning email (e.g. crossed 75% or 90% of a metric limit on the current billing period).
Sourcepub fn generate_support_confirmation(
username: &str,
email: &str,
ticket_id: &str,
subject: &str,
) -> EmailMessage
pub fn generate_support_confirmation( username: &str, email: &str, ticket_id: &str, subject: &str, ) -> EmailMessage
Generate support request confirmation email
Sourcepub fn generate_verification_email(
username: &str,
email: &str,
verification_token: &str,
) -> EmailMessage
pub fn generate_verification_email( username: &str, email: &str, verification_token: &str, ) -> EmailMessage
Generate email verification email
Sourcepub fn generate_token_rotation_reminder(
username: &str,
email: &str,
token_name: &str,
token_age_days: i64,
rotation_url: &str,
) -> EmailMessage
pub fn generate_token_rotation_reminder( username: &str, email: &str, token_name: &str, token_age_days: i64, rotation_url: &str, ) -> EmailMessage
Generate API token rotation reminder email
Sourcepub fn generate_password_reset_email(
username: &str,
email: &str,
reset_token: &str,
) -> EmailMessage
pub fn generate_password_reset_email( username: &str, email: &str, reset_token: &str, ) -> EmailMessage
Generate password reset email
Auto Trait Implementations§
impl Freeze for EmailService
impl !RefUnwindSafe for EmailService
impl Send for EmailService
impl Sync for EmailService
impl Unpin for EmailService
impl UnsafeUnpin for EmailService
impl !UnwindSafe for EmailService
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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 moreCreates a shared type from an unshared type.