Built motion from commit (unavailable).|2.4.3
[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 _0xcae2=['Imap','password','Smtp','pass','length','server','http','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','listen','sendMail','account','message','error','verifySmtp','then','Verified','catch','mailAccounts'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xcae2,0x143));var _0x2cae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcae2[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require(_0x2cae('0x0'));var BPromise=require(_0x2cae('0x1'));var _=require(_0x2cae('0x2'));var logger=require(_0x2cae('0x3'))(_0x2cae('0x4'));exports[_0x2cae('0x5')]=function(_0x45befd,_0x508f2e){return new BPromise(function(_0x7310ab,_0x1910d0){var _0x203811={'SendMail':function(_0x415f20){var _0x57cbf8=this;return new Promise(function(_0x3a3e3b,_0x1feff6){_0x508f2e[_0x2cae('0x6')](_0x415f20[_0x2cae('0x7')],_0x415f20[_0x2cae('0x8')])['then'](function(_0x49b96c){_0x3a3e3b({'code':0xc8,'message':_0x49b96c});})['catch'](function(_0x49f0d3){_0x1feff6(_0x57cbf8[_0x2cae('0x9')](0x1f4,_0x49f0d3));});});},'VerifySmtp':function(_0x1564d4){var _0x1d7657=this;return new Promise(function(_0x3212ec,_0x1e4594){_0x508f2e[_0x2cae('0xa')](_0x1564d4['account'])[_0x2cae('0xb')](function(_0x4e58c8){_0x3212ec({'code':0xc8,'message':_0x2cae('0xc')});})[_0x2cae('0xd')](function(_0xf52100){_0x1e4594(_0x1d7657[_0x2cae('0x9')](0x1f4,_0xf52100));});});},'MailAccounts':function(_0x302385){return new Promise(function(_0x9f306f,_0x48e032){var _0x356e8d=_['values'](_0x45befd[_0x2cae('0xe')]);for(var _0x13c76f=0x0;_0x13c76f<_0x356e8d['length'];_0x13c76f+=0x1){if(_0x356e8d[_0x13c76f][_0x2cae('0xf')]&&_0x356e8d[_0x13c76f][_0x2cae('0xf')][_0x2cae('0x10')]){delete _0x356e8d[_0x13c76f][_0x2cae('0xf')]['password'];}if(_0x356e8d[_0x13c76f][_0x2cae('0x11')]&&_0x356e8d[_0x13c76f][_0x2cae('0x11')]['pass']){delete _0x356e8d[_0x13c76f][_0x2cae('0x11')][_0x2cae('0x12')];}}_0x9f306f({'count':_0x356e8d[_0x2cae('0x13')],'rows':_0x356e8d});});}};var _0xe6314f=jayson[_0x2cae('0x14')](_0x203811)[_0x2cae('0x15')]();_0xe6314f['on'](_0x2cae('0x9'),function(_0x3d5834){logger['error'](JSON['stringify'](_0x3d5834));return _0x1910d0(_0x3d5834);});_0xe6314f[_0x2cae('0x5')](0x232b,_0x2cae('0x16'),function(){console[_0x2cae('0x17')](_0x2cae('0x18'),0x232b);return _0x7310ab(_0x2cae('0x19')+0x232b);});});};