Built motion from commit (unavailable).|2.5.30
[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 _0x81f9=['127.0.0.1','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','../../../config/logger','email','listen','sendMail','message','then','error','catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify'];(function(_0x38c9fa,_0x2e24d1){var _0x350e03=function(_0x4f49d5){while(--_0x4f49d5){_0x38c9fa['push'](_0x38c9fa['shift']());}};_0x350e03(++_0x2e24d1);}(_0x81f9,0x1cb));var _0x981f=function(_0x2b3bb9,_0x1556ce){_0x2b3bb9=_0x2b3bb9-0x0;var _0x5d3da5=_0x81f9[_0x2b3bb9];return _0x5d3da5;};'use strict';var jayson=require(_0x981f('0x0'));var BPromise=require(_0x981f('0x1'));var _=require(_0x981f('0x2'));var logger=require(_0x981f('0x3'))(_0x981f('0x4'));exports[_0x981f('0x5')]=function(_0x2f4041,_0x2ee908){return new BPromise(function(_0x209c05,_0x3c7a3a){var _0x29ebec={'SendMail':function(_0xd3168a){var _0x2ac325=this;return new Promise(function(_0x2d3bc8,_0x4a3261){_0x2ee908[_0x981f('0x6')](_0xd3168a['account'],_0xd3168a[_0x981f('0x7')])[_0x981f('0x8')](function(_0x60d557){_0x2d3bc8({'code':0xc8,'message':_0x60d557});})['catch'](function(_0x584d9f){_0x4a3261(_0x2ac325[_0x981f('0x9')](0x1f4,_0x584d9f));});});},'VerifySmtp':function(_0x5ca88d){var _0x2e7628=this;return new Promise(function(_0x47561f,_0x541a36){_0x2ee908['verifySmtp'](_0x5ca88d['account'])[_0x981f('0x8')](function(_0x1378fe){_0x47561f({'code':0xc8,'message':'Verified'});})[_0x981f('0xa')](function(_0x17c155){_0x541a36(_0x2e7628[_0x981f('0x9')](0x1f4,_0x17c155));});});},'MailAccounts':function(_0x46e17a){return new Promise(function(_0x269ec1,_0x3fe955){var _0xa0f97a=_[_0x981f('0xb')](_0x2f4041[_0x981f('0xc')]);for(var _0x101afe=0x0;_0x101afe<_0xa0f97a[_0x981f('0xd')];_0x101afe+=0x1){if(_0xa0f97a[_0x101afe][_0x981f('0xe')]&&_0xa0f97a[_0x101afe][_0x981f('0xe')]['password']){delete _0xa0f97a[_0x101afe][_0x981f('0xe')][_0x981f('0xf')];}if(_0xa0f97a[_0x101afe]['Smtp']&&_0xa0f97a[_0x101afe][_0x981f('0x10')][_0x981f('0x11')]){delete _0xa0f97a[_0x101afe][_0x981f('0x10')][_0x981f('0x11')];}}_0x269ec1({'count':_0xa0f97a[_0x981f('0xd')],'rows':_0xa0f97a});});}};var _0x1351ec=jayson[_0x981f('0x12')](_0x29ebec)[_0x981f('0x13')]();_0x1351ec['on']('error',function(_0x1ecbb0){logger['error'](JSON[_0x981f('0x14')](_0x1ecbb0));return _0x3c7a3a(_0x1ecbb0);});_0x1351ec[_0x981f('0x5')](0x232b,_0x981f('0x15'),function(){console['log'](_0x981f('0x16'),0x232b);return _0x209c05(_0x981f('0x17')+0x232b);});});};