From 3d4b3edc3a3e092ba675f5961f17a1f6e2fe4a76 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Wed, 6 Aug 2025 09:55:53 +0200 Subject: [PATCH] mailer: log error and do not throw this suppresses eventlog exceptions when mail is down or the mail is rejected because outbound is disabled. in apphealthmonitor, we hit a case where eventlog entries are continuously added since mailer was not sending emails. the health state of the app is never switched because mail sending failed. --- src/mailer.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/mailer.js b/src/mailer.js index f1e56b292..ab59efe72 100644 --- a/src/mailer.js +++ b/src/mailer.js @@ -66,12 +66,14 @@ async function sendMail(mailOptions) { auth: { user: mailOptions.authUser || `no-reply@${dashboardDomain}`, pass: data.relayToken - } + }, + logger: false, + debug: false // set to true for smtp logs }); const [error] = await safe(transport.sendMail(mailOptions)); - if (error) throw new BoxError(BoxError.EXTERNAL_ERROR, error); - debug(`Email "${mailOptions.subject}" sent to ${mailOptions.to}`); + if (error) debug(`Error sending Email "${mailOptions.subject}" to ${mailOptions.to}: ${error.message}`); + else debug(`Email "${mailOptions.subject}" sent to ${mailOptions.to}`); } function render(templateFile, params, translationAssets) {