Built motion from commit (unavailable).|2.5.6
[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 _0xa226=['verifySmtp','account','then','Verified','values','mailAccounts','length','Imap','password','Smtp','pass','http','stringify','127.0.0.1','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','../../../config/logger','email','listen','sendMail','catch','error'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xa226,0x18f));var _0x6a22=function(_0x51ac26,_0x2c31f4){_0x51ac26=_0x51ac26-0x0;var _0x21db16=_0xa226[_0x51ac26];return _0x21db16;};'use strict';var jayson=require(_0x6a22('0x0'));var BPromise=require(_0x6a22('0x1'));var _=require(_0x6a22('0x2'));var logger=require(_0x6a22('0x3'))(_0x6a22('0x4'));exports[_0x6a22('0x5')]=function(_0x477764,_0x27c98a){return new BPromise(function(_0x1494b8,_0x5ccdbe){var _0x334625={'SendMail':function(_0x2eedf8){var _0x12a933=this;return new Promise(function(_0x482702,_0x3dd7f1){_0x27c98a[_0x6a22('0x6')](_0x2eedf8['account'],_0x2eedf8['message'])['then'](function(_0x559748){_0x482702({'code':0xc8,'message':_0x559748});})[_0x6a22('0x7')](function(_0x2af989){_0x3dd7f1(_0x12a933[_0x6a22('0x8')](0x1f4,_0x2af989));});});},'VerifySmtp':function(_0x45e7b8){var _0x36f5c3=this;return new Promise(function(_0x2b3644,_0x42d1f4){_0x27c98a[_0x6a22('0x9')](_0x45e7b8[_0x6a22('0xa')])[_0x6a22('0xb')](function(_0x597160){_0x2b3644({'code':0xc8,'message':_0x6a22('0xc')});})[_0x6a22('0x7')](function(_0x1240fc){_0x42d1f4(_0x36f5c3[_0x6a22('0x8')](0x1f4,_0x1240fc));});});},'MailAccounts':function(_0x195fd6){return new Promise(function(_0xaef5a1,_0x2fda07){var _0x142cda=_[_0x6a22('0xd')](_0x477764[_0x6a22('0xe')]);for(var _0x4015fc=0x0;_0x4015fc<_0x142cda[_0x6a22('0xf')];_0x4015fc+=0x1){if(_0x142cda[_0x4015fc][_0x6a22('0x10')]&&_0x142cda[_0x4015fc][_0x6a22('0x10')][_0x6a22('0x11')]){delete _0x142cda[_0x4015fc]['Imap']['password'];}if(_0x142cda[_0x4015fc][_0x6a22('0x12')]&&_0x142cda[_0x4015fc]['Smtp'][_0x6a22('0x13')]){delete _0x142cda[_0x4015fc][_0x6a22('0x12')][_0x6a22('0x13')];}}_0xaef5a1({'count':_0x142cda[_0x6a22('0xf')],'rows':_0x142cda});});}};var _0x26eb02=jayson['server'](_0x334625)[_0x6a22('0x14')]();_0x26eb02['on']('error',function(_0x58ffd2){logger[_0x6a22('0x8')](JSON[_0x6a22('0x15')](_0x58ffd2));return _0x5ccdbe(_0x58ffd2);});_0x26eb02[_0x6a22('0x5')](0x232b,_0x6a22('0x16'),function(){console['log']('Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232b);return _0x1494b8(_0x6a22('0x17')+0x232b);});});};