diff --git a/process/Email_lib/process.js b/process/Email_lib/process.js index 4d83ba5711f15c75ef39f25950400f6b14f106a0..bffbe633e28bdc6119fdea0898094c96809e493e 100644 --- a/process/Email_lib/process.js +++ b/process/Email_lib/process.js @@ -11,7 +11,8 @@ import("Communication_lib"); import("DocumentTemplate_lib"); import("system.neon"); import("system.mail"); -import("Bulkmail_lib") +import("Bulkmail_lib"); +import("system.tools"); function EmailWritingUtils () {} @@ -382,18 +383,13 @@ Email.prototype.send = function (pUser) if (this.sender) mail.setSender(mailId, this.sender); var mailbridgeTitle = "mailbridge"; - - var sentMails; if(pUser) sentMails = mail.sendMailAs(pUser, mailId) else { - let mailbridgeExists = newSelect("ASYS_USERS.PROPVAL", SqlUtils.getSystemAlias()) - .from("ASYS_USERS") - .where("ASYS_USERS.PROPVAL", "title") - .and("ASYS_USERS.PROPVAL", mailbridgeTitle) - .cell(); + let mailbridgeExists = tools.getUser(mailbridgeTitle); + if(mailbridgeExists) mail.sendMailAs(mailbridgeTitle, mailId) else //check mailbridge user if this error gets thrown