1 var _0xa039=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x75\x74\x69\x6C","\x62\x6C\x75\x65\x62\x69\x72\x64","\x6C\x6F\x64\x61\x73\x68","\x6D\x6F\x6D\x65\x6E\x74","\x6D\x75\x73\x74\x61\x63\x68\x65","\x6E\x6F\x64\x65\x6D\x61\x69\x6C\x65\x72","\x6E\x6F\x64\x65\x6D\x61\x69\x6C\x65\x72\x2D\x73\x6D\x74\x70\x2D\x74\x72\x61\x6E\x73\x70\x6F\x72\x74","\x68\x74\x6D\x6C\x2D\x74\x6F\x2D\x74\x65\x78\x74","\x55\x73\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x4D\x61\x69\x6C\x52\x6F\x6F\x6D","\x54\x65\x6D\x70\x6C\x61\x74\x65","\x4D\x61\x69\x6C\x41\x63\x63\x6F\x75\x6E\x74","\x4D\x61\x69\x6C\x4D\x65\x73\x73\x61\x67\x65","\x4D\x61\x69\x6C\x53\x65\x72\x76\x65\x72\x4F\x75\x74","\x4D\x61\x69\x6C\x52\x6F\x6F\x6D\x53\x74\x61\x74\x75\x73","\x4D\x61\x69\x6C\x41\x74\x74\x61\x63\x68\x6D\x65\x6E\x74","\x65\x72\x72\x6F\x72","\x6F\x6E","\x63\x6C\x6F\x73\x65","\x53\x4D\x54\x50\x20\x53\x45\x52\x56\x45\x52\x20\x25\x73\x20\x45\x58\x49\x54\x45\x44\x20\x57\x49\x54\x48\x20\x43\x4F\x44\x45\x20\x25\x73","\x61\x72\x67\x76","\x66\x6F\x72\x6D\x61\x74","\x6C\x6F\x67","\x6D\x65\x73\x73\x61\x67\x65","\x74\x79\x70\x65","\x73\x74\x61\x74\x65","\x75\x73\x65\x72\x6E\x61\x6D\x65","\x43\x4F\x4E\x4E\x45\x43\x54\x49\x4E\x47","\x53\x4D\x54\x50\x20\x53\x45\x52\x56\x45\x52\x20\x25\x73\x20\x53\x54\x41\x52\x54\x49\x4E\x47\x2C\x20\x50\x52\x4F\x43\x45\x53\x53\x20\x49\x44\x3A\x20\x25\x73\x20","\x70\x69\x64","\x45\x52\x52\x4F\x52","\x73\x74\x72\x69\x6E\x67\x69\x66\x79","\x53\x4D\x54\x50\x20\x53\x45\x52\x56\x45\x52\x20\x25\x73\x20\x45\x52\x52\x4F\x52\x2C\x20\x50\x52\x4F\x43\x45\x53\x53\x20\x49\x44\x3A\x20\x25\x73\x20","\x73\x65\x6E\x64","\x63\x61\x74\x63\x68","\x43\x4F\x4E\x4E\x45\x43\x54\x45\x44","\x53\x4D\x54\x50\x20\x53\x45\x52\x56\x45\x52\x20\x25\x73\x20\x43\x4F\x4E\x4E\x45\x43\x54\x45\x44\x2C\x20\x50\x52\x4F\x43\x45\x53\x53\x20\x49\x44\x3A\x20\x25\x73\x20","\x74\x68\x65\x6E","\x76\x65\x72\x69\x66\x79","\x68\x6F\x73\x74","\x70\x6F\x72\x74","\x73\x73\x6C","\x70\x61\x73\x73\x77\x6F\x72\x64","\x63\x72\x65\x61\x74\x65\x54\x72\x61\x6E\x73\x70\x6F\x72\x74","\x6D\x61\x69\x6C\x41\x63\x63\x6F\x75\x6E\x74\x49\x64","\x4D\x61\x69\x6C\x41\x63\x63\x6F\x75\x6E\x74\x49\x64","\x6D\x61\x69\x6C\x53\x65\x72\x76\x65\x72\x4F\x75\x74\x49\x64","\x69\x64","\x53\x4D\x54\x50\x20\x53\x45\x52\x56\x45\x52\x20\x25\x73\x20\x53\x45\x4E\x44\x49\x4E\x47\x20\x4D\x53\x47\x2C\x20\x50\x52\x4F\x43\x45\x53\x53\x20\x49\x44\x3A\x20\x25\x73\x20","\x73\x74\x61\x74\x75\x73","\x53\x45\x4E\x44\x49\x4E\x47","\x69\x6E\x52\x65\x70\x6C\x79\x54\x6F","\x75\x70\x64\x61\x74\x65","\x46\x41\x49\x4C\x45\x44","\x72\x65\x74\x72\x79\x53\x65\x6E\x64","\x6D\x65\x73\x73\x61\x67\x65\x49\x64","\x53\x45\x4E\x54","\x68\x74\x6D\x6C","\x75\x74\x66\x38","\x74\x65\x78\x74","\x73\x75\x62\x6A\x65\x63\x74","\x6E\x61\x6D\x65","\x66\x72\x6F\x6D","\x74\x6F","\x63\x63","\x62\x63\x63","\x66\x75\x6C\x6C\x6E\x61\x6D\x65","\x65\x6D\x61\x69\x6C","\x63\x72\x65\x61\x74\x65\x64\x41\x74","\x72\x65\x6E\x64\x65\x72","\x66\x72\x6F\x6D\x53\x74\x72\x69\x6E\x67","\x4D\x61\x69\x6C\x41\x74\x74\x61\x63\x68\x6D\x65\x6E\x74\x73","\x61\x74\x74\x61\x63\x68\x6D\x65\x6E\x74\x73","\x70\x61\x74\x68","\x6D\x61\x70","\x73\x65\x6E\x64\x4D\x61\x69\x6C","\x61\x64\x64\x55\x73\x65\x72","\x66\x69\x6E\x64\x42\x79\x49\x64","\x50\x45\x4E\x44\x49\x4E\x47","\x6C\x65\x6E\x67\x74\x68","\x6D\x61\x69\x6C\x4F\x75\x74","\x61\x64\x64\x4D\x61\x69\x6C\x4D\x65\x73\x73\x61\x67\x65","\x67\x65\x74\x4D\x61\x69\x6C\x52\x6F\x6F\x6D","\x66\x69\x6E\x64\x4F\x6E\x65","","\x4D\x61\x69\x6C\x52\x6F\x6F\x6D\x49\x64","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D\x3A\x73\x73","\x63\x72\x65\x61\x74\x65"];_0xa039[0];var util=require(_0xa039[1]);var promise=require(_0xa039[2]);var _=require(_0xa039[3]);var moment=require(_0xa039[4]);var Mustache=require(_0xa039[5]);var nodemailer=require(_0xa039[6]);var smtpTransport=require(_0xa039[7]);var htmlToText=require(_0xa039[8]);var Agent=require(_0xa039[10])[_0xa039[9]];var Room=require(_0xa039[10])[_0xa039[11]];var Template=require(_0xa039[10])[_0xa039[12]];var Account=require(_0xa039[10])[_0xa039[13]];var Message=require(_0xa039[10])[_0xa039[14]];var Server=require(_0xa039[10])[_0xa039[15]];var Status=require(_0xa039[10])[_0xa039[16]];var Attachment=require(_0xa039[10])[_0xa039[17]];var smtp;var timeout;process[_0xa039[19]](_0xa039[25],function(_0xed71x15){if(_0xed71x15[_0xa039[26]]=== _0xa039[25]){onSend(_0xed71x15)};if(_0xed71x15[_0xa039[26]]=== _0xa039[27]){switch(_0xed71x15[_0xa039[27]]){case _0xa039[29]:onVerify(_0xed71x15[_0xa039[28]]);break;default:}}})[_0xa039[19]](_0xa039[20],function(_0xed71x14){console[_0xa039[24]](util[_0xa039[23]](_0xa039[21],process[_0xa039[22]][3],_0xed71x14))})[_0xa039[19]](_0xa039[18],function(_0xed71x13){console[_0xa039[18]](_0xed71x13)});console[_0xa039[24]](util[_0xa039[23]](_0xa039[30],process[_0xa039[22]][3],process[_0xa039[31]]));function onVerify(_0xed71x17){smtp[_0xa039[40]]()[_0xa039[39]](function(){process[_0xa039[35]]({type:_0xa039[27],state:_0xa039[37],source:null,log:util[_0xa039[23]](_0xa039[38],_0xed71x17,process[_0xa039[31]])})})[_0xa039[36]](function(_0xed71x13){process[_0xa039[35]]({type:_0xa039[27],state:_0xa039[32],source:JSON[_0xa039[33]](_0xed71x13),log:util[_0xa039[23]](_0xa039[34],_0xed71x17,process[_0xa039[31]])})})}function onSave(_0xed71x19){smtp= nodemailer[_0xa039[45]](smtpTransport({host:_0xed71x19[_0xa039[41]],port:_0xed71x19[_0xa039[42]],secure:_0xed71x19[_0xa039[43]],pool:true,auth:{user:_0xed71x19[_0xa039[28]],pass:_0xed71x19[_0xa039[44]]}}));smtp[_0xa039[46]]= _0xed71x19[_0xa039[47]];smtp[_0xa039[48]]= _0xed71x19[_0xa039[49]];smtp[_0xa039[28]]= _0xed71x19[_0xa039[28]];onVerify(_0xed71x19[_0xa039[28]])}function onSend(_0xed71x1b){console[_0xa039[24]](util[_0xa039[23]](_0xa039[50],process[_0xa039[22]][3],process[_0xa039[31]]));if(_0xed71x1b[_0xa039[51]]=== _0xa039[52]){var _0xed71x1c;var _0xed71x1d;var _0xed71x1e;var _0xed71x1f=_0xed71x1b;var _0xed71x20,_0xed71x21,_0xed71x22,_0xed71x23;if(_0xed71x1f[_0xa039[53]]){return Message[_0xa039[85]]({where:{messageId:_0xed71x1f[_0xa039[53]]}})[_0xa039[39]](function(_0xed71x2b){return _0xed71x2b[_0xa039[84]]({include:{model:Account,include:[{model:Template}]}})})[_0xa039[39]](function(_0xed71x2a){_0xed71x1c= _0xed71x2a;_0xed71x1d= _0xed71x2a[_0xa039[13]];return _0xed71x1c[_0xa039[83]](_0xed71x1f[_0xa039[49]])})[_0xa039[39]](function(){return _0xed71x1c[_0xa039[54]]({lastEvent:_0xa039[52],status:_0xa039[80],attachment:_0xed71x1f[_0xa039[73]]&& _0xed71x1f[_0xa039[73]][_0xa039[81]],mailOut:++_0xed71x1c[_0xa039[82]]})})[_0xa039[39]](function(){return Agent[_0xa039[79]](_0xed71x1f.UserId)})[_0xa039[39]](function(_0xed71x29){_0xed71x1e= _0xed71x29;return _0xed71x1c[_0xa039[78]](_0xed71x1e)})[_0xa039[39]](function(){_0xed71x1f[_0xa039[59]]= _0xed71x1f[_0xa039[59]]?_0xed71x1f[_0xa039[59]].toString(_0xa039[60]):null;_0xed71x1f[_0xa039[61]]= _0xed71x1f[_0xa039[61]]?_0xed71x1f[_0xa039[61]].toString(_0xa039[60]):null;var _0xed71x25=_0xed71x1d[_0xa039[12]]?Mustache[_0xa039[71]](_0xed71x1d[_0xa039[12]][_0xa039[59]],{interactionId:_0xed71x1c[_0xa039[49]],subject:_0xed71x1f[_0xa039[62]],body:_0xed71x1f[_0xa039[59]]?_0xed71x1f[_0xa039[59]]:_0xed71x1f[_0xa039[61]],accountName:_0xed71x1d[_0xa039[63]],from:_0xed71x1f[_0xa039[64]],to:_0xed71x1f[_0xa039[65]],cc:_0xed71x1f[_0xa039[66]],bcc:_0xed71x1f[_0xa039[67]],agentName:_0xed71x1e[_0xa039[68]],agentEmail:_0xed71x1e[_0xa039[69]],createdAt:_0xed71x1f[_0xa039[70]]}):_0xed71x1f[_0xa039[59]];var _0xed71x26;if(_0xed71x1f[_0xa039[61]]){_0xed71x26= _0xed71x1f[_0xa039[61]]}else {_0xed71x26= _0xed71x1f[_0xa039[59]]?htmlToText[_0xa039[72]](_0xed71x1f[_0xa039[59]],{wordwrap:false}):null};var _0xed71x27={status:_0xed71x1f[_0xa039[51]],from:_0xed71x1f[_0xa039[64]],to:_0xed71x1f[_0xa039[65]],cc:_0xed71x1f[_0xa039[66]],bcc:_0xed71x1f[_0xa039[67]],subject:_0xed71x1f[_0xa039[62]],html:_0xed71x25,text:_0xed71x26};if(_0xed71x1f[_0xa039[73]]){_0xed71x27[_0xa039[74]]= _[_0xa039[76]](_0xed71x1f.MailAttachments,function(_0xed71x28){return {path:_0xed71x28[_0xa039[75]],filename:_0xed71x28[_0xa039[63]]}})};return smtp[_0xa039[77]](_0xed71x27)})[_0xa039[39]](function(_0xed71x24){process[_0xa039[35]]({msgId:_0xed71x1f[_0xa039[49]],roomId:_0xed71x1c[_0xa039[49]],type:_0xa039[54],messageId:_0xed71x24[_0xa039[57]],status:_0xa039[58],retry:_0xed71x1f[_0xa039[56]]})})[_0xa039[36]](function(_0xed71x13){console[_0xa039[18]](_0xed71x13);process[_0xa039[35]]({msgId:_0xed71x1f[_0xa039[49]],roomId:_0xed71x1c[_0xa039[49]],type:_0xa039[54],status:_0xa039[55],retry:_0xed71x1f[_0xa039[56]]})})}else {return Account[_0xa039[79]](smtp[_0xa039[46]],{include:[{model:Template}]})[_0xa039[39]](function(_0xed71x2c){_0xed71x1d= _0xed71x2c;if(_0xed71x1b[_0xa039[87]]){return Room[_0xa039[79]](_0xed71x1b.MailRoomId)}else {return Agent[_0xa039[79]](_0xed71x1b.UserId)[_0xa039[39]](function(_0xed71x2d){return Room[_0xa039[89]]({subject:_0xed71x1f[_0xa039[62]],from:_0xed71x1f[_0xa039[64]],account:_0xed71x2c?_0xed71x2c[_0xa039[63]]:null,status:_0xa039[80],lastEvent:_0xa039[52],attachment:_0xed71x1f[_0xa039[73]]&& _0xed71x1f[_0xa039[73]][_0xa039[81]],MailAccountId:_0xed71x2c?_0xed71x2c[_0xa039[49]]:null,mailOut:1,arrivedAt:moment()[_0xa039[23]](_0xa039[88]),MailRoomStatuses:[{status:_0xa039[80],data1:_0xed71x2d[_0xa039[63]],data2:_0xed71x2d[_0xa039[68]],UserId:_0xed71x2d[_0xa039[49]]}]},{include:[{model:Message},{model:Status}]})})}})[_0xa039[39]](function(_0xed71x2a){_0xed71x1c= _0xed71x2a;return _0xed71x1c[_0xa039[83]](_0xed71x1f[_0xa039[49]])})[_0xa039[39]](function(){return Agent[_0xa039[79]](_0xed71x1f.UserId)})[_0xa039[39]](function(_0xed71x29){_0xed71x1e= _0xed71x29;return _0xed71x1c[_0xa039[78]](_0xed71x1e)})[_0xa039[39]](function(){_0xed71x1f[_0xa039[59]]= _0xed71x1f[_0xa039[59]]?_0xed71x1f[_0xa039[59]].toString(_0xa039[60]):null;_0xed71x1f[_0xa039[61]]= _0xed71x1f[_0xa039[61]]?_0xed71x1f[_0xa039[61]].toString(_0xa039[60]):null;var _0xed71x25=_0xed71x1d[_0xa039[12]]?Mustache[_0xa039[71]](_0xed71x1d[_0xa039[12]][_0xa039[59]],{interactionId:_0xed71x1c[_0xa039[49]],subject:_0xed71x1f[_0xa039[62]],body:_0xed71x1f[_0xa039[59]]?_0xed71x1f[_0xa039[59]]:_0xed71x1f[_0xa039[61]],accountName:_0xed71x1d[_0xa039[63]],from:_0xed71x1f[_0xa039[64]],to:_0xed71x1f[_0xa039[65]],cc:_0xed71x1f[_0xa039[66]],bcc:_0xed71x1f[_0xa039[67]],agentName:_0xed71x1e?_0xed71x1e[_0xa039[68]]:_0xa039[86],agentEmail:_0xed71x1e?_0xed71x1e[_0xa039[69]]:_0xa039[86],createdAt:_0xed71x1f[_0xa039[70]]}):_0xed71x1f[_0xa039[59]];var _0xed71x26;if(_0xed71x1f[_0xa039[61]]){_0xed71x26= _0xed71x1f[_0xa039[61]]}else {_0xed71x26= _0xed71x1f[_0xa039[59]]?htmlToText[_0xa039[72]](_0xed71x1f[_0xa039[59]],{wordwrap:false}):null};var _0xed71x27={status:_0xed71x1f[_0xa039[51]],from:_0xed71x1f[_0xa039[64]],to:_0xed71x1f[_0xa039[65]],cc:_0xed71x1f[_0xa039[66]],bcc:_0xed71x1f[_0xa039[67]],subject:_0xed71x1f[_0xa039[62]],html:_0xed71x25,text:_0xed71x26};if(_0xed71x1f[_0xa039[73]]){_0xed71x27[_0xa039[74]]= _[_0xa039[76]](_0xed71x1f.MailAttachments,function(_0xed71x28){return {path:_0xed71x28[_0xa039[75]],filename:_0xed71x28[_0xa039[63]]}})};return smtp[_0xa039[77]](_0xed71x27)})[_0xa039[39]](function(_0xed71x24){process[_0xa039[35]]({msgId:_0xed71x1f[_0xa039[49]],roomId:_0xed71x1c[_0xa039[49]],type:_0xa039[54],messageId:_0xed71x24[_0xa039[57]],status:_0xa039[58],retry:_0xed71x1f[_0xa039[56]]})})[_0xa039[36]](function(_0xed71x13){console[_0xa039[18]](_0xed71x13);process[_0xa039[35]]({msgId:_0xed71x1f[_0xa039[49]],roomId:_0xed71x1c[_0xa039[49]],type:_0xa039[54],status:_0xa039[55],retry:_0xed71x1f[_0xa039[56]]})})}}}Server[_0xa039[79]](process[_0xa039[22]][2])[_0xa039[39]](function(_0xed71x19){onSave(_0xed71x19)})[_0xa039[36]](function(_0xed71x13){console[_0xa039[18]](_0xed71x13)})