diff --git a/apps/OpenSign/.gitignore b/apps/OpenSign/.gitignore index cc964cb27..b96e769c8 100644 --- a/apps/OpenSign/.gitignore +++ b/apps/OpenSign/.gitignore @@ -10,6 +10,7 @@ # production /build +/mfbuild # misc .env diff --git a/apps/OpenSignServer/cloud/parsefunction/sendMail.js b/apps/OpenSignServer/cloud/parsefunction/sendMail.js index fb964e28f..c607c2822 100644 --- a/apps/OpenSignServer/cloud/parsefunction/sendMail.js +++ b/apps/OpenSignServer/cloud/parsefunction/sendMail.js @@ -55,29 +55,27 @@ async function sendmail(req) { const file = { filename: pdfName || 'exported.pdf', content: process.env.SMTP_ENABLE ? PdfBuffer : undefined, //fs.readFileSync('./exports/exported_file_1223.pdf'), - data: process.env.SMTP_ENABLE ? undefined : PdfBuffer, + data: process.env.SMTP_ENABLE ? undefined : PdfBuffer, }; // const html = "

Hello!

This is a html checking mail

" const from = req.params.from || ''; + const mailsender = process.env.SMTP_ENABLE + ? process.env.SMTP_USER_EMAIL + : process.env.MAILGUN_SENDER; const messageParams = { - from: - from + ' <' + process.env.SMTP_ENABLE - ? process.env.SMTP_USER_EMAIL - : process.env.MAILGUN_SENDER + '>', + from: from + ' <' + mailsender + '>', to: req.params.recipient, subject: req.params.subject, text: req.params.text || 'mail', html: req.params.html || '', - attachments: process.env.SMTP_ENABLE ? [file] : undefined, - attachment: process.env.SMTP_ENABLE ? undefined : file, + attachments: process.env.SMTP_ENABLE ? [file] : undefined, + attachment: process.env.SMTP_ENABLE ? undefined : file, }; - if (transporterSMTP) { const res = await transporterSMTP.sendMail(messageParams); - console.log('Res ', res); if (!res.err) { return { @@ -96,11 +94,12 @@ async function sendmail(req) { } } else { const from = req.params.from || ''; + const mailsender = process.env.SMTP_ENABLE + ? process.env.SMTP_USER_EMAIL + : process.env.MAILGUN_SENDER; + const messageParams = { - from: - from + ' <' + process.env.SMTP_ENABLE - ? process.env.SMTP_USER_EMAIL - : process.env.MAILGUN_SENDER + '>', + from: from + ' <' + mailsender + '>', to: req.params.recipient, subject: req.params.subject, text: req.params.text || 'mail', @@ -109,7 +108,6 @@ async function sendmail(req) { if (transporterSMTP) { const res = await transporterSMTP.sendMail(messageParams); - console.log('Res ', res); if (!res.err) { return {