Skip to content
Snippets Groups Projects
Commit 8a7664a4 authored by Johannes Hörmann's avatar Johannes Hörmann
Browse files

fix: use eml file directly to send mail

parent cbdbd813
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment