UNPKG

flexbiz-server

Version:

Flexible Server

4 lines (3 loc) 977 B
const mailAccount=global.getModel("mailaccount"),path=require("path");exports.getAccount=function($account_id$$,$done$$){mailAccount.findOne({_id:$account_id$$}).lean().then(function($account$$){if(!$account$$)return $done$$("Don't find account "+$account_id$$);$done$$(null,$account$$)}).catch($e$$=>{$done$$($e$$)})}; exports.sendHtml=function($options$$,$callback$$=()=>{},$sender$$){let $onImportProcess$$=path.dirname(__dirname)+"/workers/sendEmail.js";if(!global.sendEmailPool){const $StaticPool$$=require("./WorkerStaticPool");global.sendEmailPool=new $StaticPool$$($onImportProcess$$)}global.sendEmailPool.exec({options:$options$$,configs:{sender:$sender$$||global.configs.sender,company:global.configs.company,google_credentials:global.configs.google_credentials?JSON.stringify(global.configs.google_credentials): "",paths:global.configs.paths}},$response$$=>{$response$$.error?$callback$$($response$$.error):$callback$$(null,$response$$.data,$response$$.columns)})};