From 36623c1cae948bfd88c456aea6459a35166b240a Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 21 Aug 2023 13:48:51 +0200 Subject: [PATCH] refs #5941 fix(sendToSupport): fix email from --- back/methods/osticket/sendToSupport.js | 2 ++ print/core/smtp.js | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/back/methods/osticket/sendToSupport.js b/back/methods/osticket/sendToSupport.js index 320691e23..a9fcf28a9 100644 --- a/back/methods/osticket/sendToSupport.js +++ b/back/methods/osticket/sendToSupport.js @@ -33,6 +33,7 @@ module.exports = Self => { await Self.app.models.EmailUser.findById(ctx.req.accessToken.userId, {fields: ['email']}); let html = `Motivo:
${reason}
`; + html += `Usuario:
${ctx.req.accessToken.userId} ${emailUser.email}
`; for (const data in additionalData) html += `${data}:
${tryParse(additionalData[data])}
`; @@ -40,6 +41,7 @@ module.exports = Self => { const subjectReason = JSON.parse(additionalData?.httpRequest)?.data?.error; smtp.send({ to: config.app.reportEmail, + from: emailUser.email, replyTo: emailUser.email, subject: '[Support-Salix] ' + diff --git a/print/core/smtp.js b/print/core/smtp.js index 8c07e7eca..01d66b6f0 100644 --- a/print/core/smtp.js +++ b/print/core/smtp.js @@ -9,7 +9,7 @@ module.exports = { }, async send(options) { - options.from = `${config.app.senderName} <${config.app.senderEmail}>`; + options.from = options.from ?? `${config.app.senderName} <${config.app.senderEmail}>`; const env = process.env.NODE_ENV; const canSend = env === 'production' || !env || options.force; @@ -19,8 +19,10 @@ module.exports = { return Promise.resolve(true); } - if (!env) + if (!env) { options.to = config.app.senderEmail; + options.from = `${config.app.senderName} <${config.app.senderEmail}>`; + } let res; let error;