Built motion from commit (unavailable).|2.4.4
[motion2.git] / server / services / email / server / index.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0xa9fc=['error','verifySmtp','values','mailAccounts','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','../../../config/logger','email','sendMail','account','message','then','catch'];(function(_0x48c509,_0x1e47fe){var _0xa847c7=function(_0x1510dc){while(--_0x1510dc){_0x48c509['push'](_0x48c509['shift']());}};_0xa847c7(++_0x1e47fe);}(_0xa9fc,0x19f));var _0xca9f=function(_0x596284,_0x1cd02b){_0x596284=_0x596284-0x0;var _0x5313c6=_0xa9fc[_0x596284];return _0x5313c6;};'use strict';var jayson=require(_0xca9f('0x0'));var BPromise=require(_0xca9f('0x1'));var _=require(_0xca9f('0x2'));var logger=require(_0xca9f('0x3'))(_0xca9f('0x4'));exports['listen']=function(_0x379e68,_0x4dc099){return new BPromise(function(_0xe81cd,_0x32709b){var _0x5d2ddf={'SendMail':function(_0x5eb9af){var _0x5c7268=this;return new Promise(function(_0x234d90,_0x48f9ca){_0x4dc099[_0xca9f('0x5')](_0x5eb9af[_0xca9f('0x6')],_0x5eb9af[_0xca9f('0x7')])[_0xca9f('0x8')](function(_0x244d4d){_0x234d90({'code':0xc8,'message':_0x244d4d});})[_0xca9f('0x9')](function(_0x4713f0){_0x48f9ca(_0x5c7268[_0xca9f('0xa')](0x1f4,_0x4713f0));});});},'VerifySmtp':function(_0x5cd1db){var _0x2bdf62=this;return new Promise(function(_0x4326a5,_0x2f0af9){_0x4dc099[_0xca9f('0xb')](_0x5cd1db['account'])[_0xca9f('0x8')](function(_0x4779a0){_0x4326a5({'code':0xc8,'message':'Verified'});})[_0xca9f('0x9')](function(_0x49d36a){_0x2f0af9(_0x2bdf62[_0xca9f('0xa')](0x1f4,_0x49d36a));});});},'MailAccounts':function(_0x2aefea){return new Promise(function(_0x14cf3a,_0x13c082){var _0x109ec0=_[_0xca9f('0xc')](_0x379e68[_0xca9f('0xd')]);for(var _0x864d21=0x0;_0x864d21<_0x109ec0['length'];_0x864d21+=0x1){if(_0x109ec0[_0x864d21]['Imap']&&_0x109ec0[_0x864d21][_0xca9f('0xe')]['password']){delete _0x109ec0[_0x864d21]['Imap'][_0xca9f('0xf')];}if(_0x109ec0[_0x864d21][_0xca9f('0x10')]&&_0x109ec0[_0x864d21]['Smtp'][_0xca9f('0x11')]){delete _0x109ec0[_0x864d21]['Smtp'][_0xca9f('0x11')];}}_0x14cf3a({'count':_0x109ec0['length'],'rows':_0x109ec0});});}};var _0x22c161=jayson[_0xca9f('0x12')](_0x5d2ddf)[_0xca9f('0x13')]();_0x22c161['on'](_0xca9f('0xa'),function(_0x25008f){logger['error'](JSON[_0xca9f('0x14')](_0x25008f));return _0x32709b(_0x25008f);});_0x22c161['listen'](0x232b,_0xca9f('0x15'),function(){console[_0xca9f('0x16')](_0xca9f('0x17'),0x232b);return _0xe81cd(_0xca9f('0x18')+0x232b);});});};