[web] support email sender customization for email notifications (#33035)

GitOrigin-RevId: 9aa298c233c1f314ef3bdb381c20692bd0d4e212
This commit is contained in:
Kristina
2026-04-27 09:53:17 +02:00
committed by Copybot
parent 4db3982c08
commit b556fd40b5
2 changed files with 9 additions and 1 deletions

View File

@@ -97,7 +97,7 @@ async function sendEmail(options, emailType) {
metrics.inc('email')
const sendMailOptions = {
to: options.to,
from: EMAIL_SETTINGS.fromAddress || '',
from: options.from || EMAIL_SETTINGS.fromAddress || '',
subject: options.subject,
html: options.html,
text: options.text,

View File

@@ -99,6 +99,14 @@ describe('EmailSender', function () {
})
})
it('should use opts.from as override for settings fromAddress when provided', async function (ctx) {
ctx.opts.from = 'no-reply@example.com'
await ctx.EmailSender.promises.sendEmail(ctx.opts)
expect(ctx.sesClient.sendMail).to.have.been.calledWithMatch({
from: 'no-reply@example.com',
})
})
it('should not send an email when the rate limiter says no', async function (ctx) {
ctx.opts.sendingUser_id = '12321312321'
ctx.rateLimiter.consume.rejects({ remainingPoints: 0 })