flexbiz-server
Version:
Flexible Server
4 lines (3 loc) • 995 B
JavaScript
;const mailAccount=global.getModel("mailaccount"),path=require("path");exports.getAccount=function($account_id$$,$done$$){mailAccount.findOne({_id:$account_id$$}).lean().exec(function($e$$,$account$$){if($e$$)return $done$$($e$$);if(!$account$$)return $done$$("Don't find account "+$account_id$$);$done$$(null,$account$$)})};
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)})};