From 3e79223407479387abd606c884f4e0d7f58019a6 Mon Sep 17 00:00:00 2001 From: Piyush Gupta Date: Mon, 6 Oct 2025 22:02:07 +0530 Subject: [PATCH] fix: review comments --- backend/src/services/user/user-service.ts | 24 +++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/backend/src/services/user/user-service.ts b/backend/src/services/user/user-service.ts index c6385434d..f5210290c 100644 --- a/backend/src/services/user/user-service.ts +++ b/backend/src/services/user/user-service.ts @@ -348,16 +348,20 @@ export const userServiceFactory = ({ const deleteUser = async (userId: string) => { const user = await userDAL.deleteById(userId); - if (user?.email) { - // Send email to user to confirm account deletion - await smtpService.sendMail({ - template: SmtpTemplates.AccountDeletionConfirmation, - subjectLine: "Your Infisical account has been deleted", - recipients: [user.email], - substitutions: { - email: user.email - } - }); + try { + if (user?.email) { + // Send email to user to confirm account deletion + await smtpService.sendMail({ + template: SmtpTemplates.AccountDeletionConfirmation, + subjectLine: "Your Infisical account has been deleted", + recipients: [user.email], + substitutions: { + email: user.email + } + }); + } + } catch (error) { + logger.error(error, `Failed to send account deletion confirmation email to ${user.email}`); } return user;