From 8a7664a420ce7b15e8f1b11af395938888c394eb Mon Sep 17 00:00:00 2001 From: Johannes Hoermann <j.hoermann@adito.de> Date: Thu, 5 Sep 2019 12:17:12 +0200 Subject: [PATCH] fix: use eml file directly to send mail --- process/Email_lib/process.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/process/Email_lib/process.js b/process/Email_lib/process.js index 07de725f02..4aff8cc616 100644 --- a/process/Email_lib/process.js +++ b/process/Email_lib/process.js @@ -168,11 +168,12 @@ Email.prototype._newMailObject = function() { var ENCODING = "UTF-8"; var mailId; - var originalRfcDecoded = this.originalRfc ? util.decodeBase64String(this.originalRfc) : null; + var emlFile = this.emlFile ? this.emlFile : null; + try { - if (originalRfcDecoded) - mailId = mail.newMail(originalRfcDecoded, mail.FORMAT_MIME); + if (emlFile) + mailId = mail.newMail(emlFile, mail.FORMAT_MIME); else mailId = mail.newMail(); @@ -182,14 +183,14 @@ Email.prototype._newMailObject = function() //TODO: fix this dirty workaround [waiting for #1038963], since newMail causes an error on the first call after a user logged in logging.log(ex); util.sleep(1500); - if (originalRfcDecoded) - mailId = mail.newMail(originalRfcDecoded, mail.FORMAT_MIME); + if (emlFile) + mailId = mail.newMail(emlFile, mail.FORMAT_MIME); else mailId = mail.newMail(); } - if (originalRfcDecoded) + if (emlFile) { mail.clearRecipients(mailId, mail.RECIPIENT_TO); mail.clearRecipients(mailId, mail.RECIPIENT_CC); @@ -205,11 +206,11 @@ Email.prototype._newMailObject = function() if (this.bccRecipients.length) mail.addRecipients(mailId, mail.RECIPIENT_BCC, this.bccRecipients); - // only alter subject and text, if no rfc is used - if (!this.originalRfc) + mail.setSubject(mailId, this.subject || "", ENCODING); + + // only alter subject and text, if no eml is used + if (!emlFile) { - mail.setSubject(mailId, this.subject || "", ENCODING); - if (this.body) mail.addText(mailId, this.body, "text/html", ENCODING, null); else -- GitLab