You've already forked authentication-service
mirror of
https://github.com/matrix-org/matrix-authentication-service.git
synced 2025-07-31 09:24:31 +03:00
Better log email errors
This commit is contained in:
@ -90,6 +90,17 @@ impl Mailer {
|
|||||||
/// # Errors
|
/// # Errors
|
||||||
///
|
///
|
||||||
/// Will return `Err` if the email failed rendering or failed sending
|
/// Will return `Err` if the email failed rendering or failed sending
|
||||||
|
#[tracing::instrument(
|
||||||
|
skip_all,
|
||||||
|
fields(
|
||||||
|
email.to = %to,
|
||||||
|
email.from = %self.from,
|
||||||
|
user.id = %context.user().id,
|
||||||
|
user_email_verification.id = %context.verification().id,
|
||||||
|
user_email_verification.code = context.verification().code,
|
||||||
|
),
|
||||||
|
err,
|
||||||
|
)]
|
||||||
pub async fn send_verification_email(
|
pub async fn send_verification_email(
|
||||||
&self,
|
&self,
|
||||||
to: Mailbox,
|
to: Mailbox,
|
||||||
|
@ -147,7 +147,6 @@ impl AsyncTransport for Transport {
|
|||||||
match self.inner.as_ref() {
|
match self.inner.as_ref() {
|
||||||
TransportInner::Blackhole => {
|
TransportInner::Blackhole => {
|
||||||
tracing::warn!(
|
tracing::warn!(
|
||||||
?envelope,
|
|
||||||
"An email was supposed to be sent but no email backend is configured"
|
"An email was supposed to be sent but no email backend is configured"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -594,6 +594,18 @@ impl EmailVerificationContext {
|
|||||||
pub fn new(user: User, verification: UserEmailVerification) -> Self {
|
pub fn new(user: User, verification: UserEmailVerification) -> Self {
|
||||||
Self { user, verification }
|
Self { user, verification }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get the user to which this email is being sent
|
||||||
|
#[must_use]
|
||||||
|
pub fn user(&self) -> &User {
|
||||||
|
&self.user
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Get the verification code being sent
|
||||||
|
#[must_use]
|
||||||
|
pub fn verification(&self) -> &UserEmailVerification {
|
||||||
|
&self.verification
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TemplateContext for EmailVerificationContext {
|
impl TemplateContext for EmailVerificationContext {
|
||||||
|
Reference in New Issue
Block a user