From cc9f61a92e07ea3a79fdfa9ace8cf91222ebc909 Mon Sep 17 00:00:00 2001 From: Domagoj Kriskovic Date: Thu, 30 Nov 2023 12:56:10 +0100 Subject: [PATCH] Added category support for sendgrid (#15970) * Added category support for sendgrid * use category only for confirmation code GitOrigin-RevId: 1b93d8d0ac3699b9ad9f633f62b6471d163a2fba --- services/web/app/src/Features/Email/EmailSender.js | 6 ++++++ .../app/src/Features/User/UserEmailsConfirmationHandler.js | 1 + 2 files changed, 7 insertions(+) diff --git a/services/web/app/src/Features/Email/EmailSender.js b/services/web/app/src/Features/Email/EmailSender.js index 6433bd59f9..dee3be40d8 100644 --- a/services/web/app/src/Features/Email/EmailSender.js +++ b/services/web/app/src/Features/Email/EmailSender.js @@ -94,6 +94,12 @@ async function sendEmail(options) { if (EMAIL_SETTINGS.textEncoding != null) { sendMailOptions.textEncoding = EMAIL_SETTINGS.textEncoding } + if (options.category) { + // category support for sendgrid + sendMailOptions.headers = { + 'X-SMTPAPI': JSON.stringify({ category: options.category }), + } + } await client.sendMail(sendMailOptions) } catch (err) { throw new OError('error sending message').withCause(err) diff --git a/services/web/app/src/Features/User/UserEmailsConfirmationHandler.js b/services/web/app/src/Features/User/UserEmailsConfirmationHandler.js index 48fcbafc9a..399c4a080d 100644 --- a/services/web/app/src/Features/User/UserEmailsConfirmationHandler.js +++ b/services/web/app/src/Features/User/UserEmailsConfirmationHandler.js @@ -60,6 +60,7 @@ async function sendConfirmationCode(email) { await EmailHandler.promises.sendEmail('confirmCode', { to: email, confirmCode, + category: ['ConfirmEmail'], }) return {