a16a8a8d1dc27dbcdbcb563cf725ad20eb1bbf12
[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 _0x7a6d=['RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','../../../config/logger','listen','sendMail','account','message','then','catch','verifySmtp','Verified','error','values','mailAccounts','length','Imap','Smtp','pass','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!'];(function(_0x3dc252,_0x3b9f15){var _0xb259e4=function(_0x17e164){while(--_0x17e164){_0x3dc252['push'](_0x3dc252['shift']());}};_0xb259e4(++_0x3b9f15);}(_0x7a6d,0x91));var _0xd7a6=function(_0x2f9467,_0x40576f){_0x2f9467=_0x2f9467-0x0;var _0x39894c=_0x7a6d[_0x2f9467];return _0x39894c;};'use strict';var jayson=require(_0xd7a6('0x0'));var BPromise=require(_0xd7a6('0x1'));var _=require('lodash');var logger=require(_0xd7a6('0x2'))('email');exports[_0xd7a6('0x3')]=function(_0x5e3a2a,_0x49c8e4){return new BPromise(function(_0x5458f9,_0x1f3b0e){var _0x3570f5={'SendMail':function(_0x2df438){var _0x46c84a=this;return new Promise(function(_0x43b62b,_0x2b8cc6){_0x49c8e4[_0xd7a6('0x4')](_0x2df438[_0xd7a6('0x5')],_0x2df438[_0xd7a6('0x6')])[_0xd7a6('0x7')](function(_0x3d3ac5){_0x43b62b({'code':0xc8,'message':_0x3d3ac5});})[_0xd7a6('0x8')](function(_0x342e1b){_0x2b8cc6(_0x46c84a['error'](0x1f4,_0x342e1b));});});},'VerifySmtp':function(_0x5620c6){var _0x224d6f=this;return new Promise(function(_0x12fc5b,_0x3fa8aa){_0x49c8e4[_0xd7a6('0x9')](_0x5620c6[_0xd7a6('0x5')])[_0xd7a6('0x7')](function(_0xcc8a35){_0x12fc5b({'code':0xc8,'message':_0xd7a6('0xa')});})[_0xd7a6('0x8')](function(_0xf8ac38){_0x3fa8aa(_0x224d6f[_0xd7a6('0xb')](0x1f4,_0xf8ac38));});});},'MailAccounts':function(_0x55231d){return new Promise(function(_0x117e0f,_0x32824b){var _0x498750=_[_0xd7a6('0xc')](_0x5e3a2a[_0xd7a6('0xd')]);for(var _0x48230e=0x0;_0x48230e<_0x498750[_0xd7a6('0xe')];_0x48230e+=0x1){if(_0x498750[_0x48230e][_0xd7a6('0xf')]&&_0x498750[_0x48230e][_0xd7a6('0xf')]['password']){delete _0x498750[_0x48230e][_0xd7a6('0xf')]['password'];}if(_0x498750[_0x48230e][_0xd7a6('0x10')]&&_0x498750[_0x48230e]['Smtp'][_0xd7a6('0x11')]){delete _0x498750[_0x48230e][_0xd7a6('0x10')][_0xd7a6('0x11')];}}_0x117e0f({'count':_0x498750[_0xd7a6('0xe')],'rows':_0x498750});});}};var _0x320e88=jayson['server'](_0x3570f5)[_0xd7a6('0x12')]();_0x320e88['on'](_0xd7a6('0xb'),function(_0x12eeb5){logger[_0xd7a6('0xb')](JSON[_0xd7a6('0x13')](_0x12eeb5));return _0x1f3b0e(_0x12eeb5);});_0x320e88[_0xd7a6('0x3')](0x232b,_0xd7a6('0x14'),function(){console[_0xd7a6('0x15')](_0xd7a6('0x16'),0x232b);return _0x5458f9(_0xd7a6('0x17')+0x232b);});});};