diff --git a/apps/labrinth/src/queue/email.rs b/apps/labrinth/src/queue/email.rs index 5ee5374b17..e3c914548a 100644 --- a/apps/labrinth/src/queue/email.rs +++ b/apps/labrinth/src/queue/email.rs @@ -225,10 +225,22 @@ impl EmailQueue { .await .wrap_internal_err("fetching user from database")?; - let Some(mailbox) = maybe_user - .and_then(|user| user.email) - .and_then(|email| email.parse().ok()) - else { + let Some(user) = maybe_user else { + return Ok(( + notification.id, + NotificationDeliveryStatus::SkippedPreferences, + )); + }; + + // user email is new email at this point, pull old email from the notification body + let mailbox = match ¬ification.body { + NotificationBody::EmailChanged { to_email, .. } => { + to_email.parse().ok() + } + _ => user.email.and_then(|email| email.parse().ok()), + }; + + let Some(mailbox) = mailbox else { return Ok(( notification.id, NotificationDeliveryStatus::SkippedPreferences,