2d1b61a88b4f8609a2b044f7161ce00d21a3ae59
[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 _0x28f8=['http','stringify','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','../../../config/logger','listen','account','message','error','verifySmtp','then','Verified','values','length','Imap','password','Smtp','pass','server'];(function(_0x710cf0,_0x2dee3c){var _0x2fb53f=function(_0x47968c){while(--_0x47968c){_0x710cf0['push'](_0x710cf0['shift']());}};_0x2fb53f(++_0x2dee3c);}(_0x28f8,0xca));var _0x828f=function(_0x28e96c,_0x2d75ed){_0x28e96c=_0x28e96c-0x0;var _0x1db3d5=_0x28f8[_0x28e96c];return _0x1db3d5;};'use strict';var jayson=require(_0x828f('0x0'));var BPromise=require(_0x828f('0x1'));var _=require(_0x828f('0x2'));var logger=require(_0x828f('0x3'))('email');exports[_0x828f('0x4')]=function(_0x1ef424,_0xdbe760){return new BPromise(function(_0x1882b8,_0x35fa06){var _0x4d4450={'SendMail':function(_0x1f5adf){var _0x4d48cf=this;return new Promise(function(_0x10afb0,_0x3afaca){_0xdbe760['sendMail'](_0x1f5adf[_0x828f('0x5')],_0x1f5adf[_0x828f('0x6')])['then'](function(_0x46e121){_0x10afb0({'code':0xc8,'message':_0x46e121});})['catch'](function(_0x3638fb){_0x3afaca(_0x4d48cf[_0x828f('0x7')](0x1f4,_0x3638fb));});});},'VerifySmtp':function(_0x77b8d5){var _0x58772f=this;return new Promise(function(_0x319983,_0x37e6b9){_0xdbe760[_0x828f('0x8')](_0x77b8d5[_0x828f('0x5')])[_0x828f('0x9')](function(_0x2c6c0d){_0x319983({'code':0xc8,'message':_0x828f('0xa')});})['catch'](function(_0x1972ee){_0x37e6b9(_0x58772f['error'](0x1f4,_0x1972ee));});});},'MailAccounts':function(_0x3b5751){return new Promise(function(_0x1cedad,_0x228da3){var _0x3b7015=_[_0x828f('0xb')](_0x1ef424['mailAccounts']);for(var _0x490067=0x0;_0x490067<_0x3b7015[_0x828f('0xc')];_0x490067+=0x1){if(_0x3b7015[_0x490067][_0x828f('0xd')]&&_0x3b7015[_0x490067][_0x828f('0xd')][_0x828f('0xe')]){delete _0x3b7015[_0x490067][_0x828f('0xd')]['password'];}if(_0x3b7015[_0x490067][_0x828f('0xf')]&&_0x3b7015[_0x490067][_0x828f('0xf')][_0x828f('0x10')]){delete _0x3b7015[_0x490067][_0x828f('0xf')][_0x828f('0x10')];}}_0x1cedad({'count':_0x3b7015['length'],'rows':_0x3b7015});});}};var _0x19261e=jayson[_0x828f('0x11')](_0x4d4450)[_0x828f('0x12')]();_0x19261e['on'](_0x828f('0x7'),function(_0x432105){logger['error'](JSON[_0x828f('0x13')](_0x432105));return _0x35fa06(_0x432105);});_0x19261e[_0x828f('0x4')](0x232b,'127.0.0.1',function(){console['log'](_0x828f('0x14'),0x232b);return _0x1882b8(_0x828f('0x15')+0x232b);});});};