a684c60caceabee0cc60a5c503470933e498494d
[motion.git] / server / config / routing / sendMail.js
1 var _0xe013=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x2E\x2E\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x2E\x2F\x73\x74\x72\x75\x63\x74\x75\x72\x65","\x70\x61\x74\x68","\x63\x68\x69\x6C\x64\x5F\x70\x72\x6F\x63\x65\x73\x73","\x75\x74\x69\x6C","\x2E\x2E\x2F\x75\x74\x69\x6C","\x6D\x6F\x6D\x65\x6E\x74","\x6D\x75\x73\x74\x61\x63\x68\x65","\x66\x73\x2D\x65\x78\x74\x72\x61","\x55\x73\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x4D\x61\x69\x6C\x4D\x65\x73\x73\x61\x67\x65","\x4D\x61\x69\x6C\x41\x63\x63\x6F\x75\x6E\x74","\x54\x65\x6D\x70\x6C\x61\x74\x65","\x4D\x61\x69\x6C\x41\x74\x74\x61\x63\x68\x6D\x65\x6E\x74","\x61\x70\x70","\x64\x61\x74\x61","\x6E\x65\x78\x74","\x69\x6E\x69\x74","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x74\x68\x65\x6E","\x63\x72\x65\x61\x74\x65","\x73\x75\x62\x6A\x65\x63\x74","\x4D\x61\x69\x6C\x52\x6F\x6F\x6D\x49\x64","\x63\x68\x61\x6E\x6E\x65\x6C","\x6D\x61\x69\x6C","\x72\x6F\x6F\x6D\x69\x64","\x68\x74\x6D\x6C","\x61\x63\x63\x6F\x75\x6E\x74\x6E\x61\x6D\x65","\x2C\x20","\x6A\x6F\x69\x6E","\x66\x72\x6F\x6D","\x74\x6F","\x63\x63","\x63\x72\x65\x61\x74\x65\x64\x41\x74","\x72\x65\x6E\x64\x65\x72","\x66\x61\x78","\x64\x61\x74\x61\x36","\x79\x65\x73","\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\x42\x61\x73\x65\x6E\x61\x6D\x65","\x6D\x65\x73\x73\x61\x67\x65\x69\x64","\x62\x6F\x64\x79","\x74\x65\x78\x74","\x66\x69\x6E\x64\x42\x79\x49\x64","\x6D\x65\x73\x73\x61\x67\x65\x73","\x6D\x6F\x64\x65\x6C\x73","\x61\x64\x64\x72\x65\x73\x73","\x70\x75\x73\x68","\x64\x61\x74\x61\x32","\x64\x61\x74\x61\x39","\x64\x61\x74\x61\x38","\x2E\x70\x64\x66","\x72\x6F\x6F\x74","\x73\x65\x72\x76\x65\x72","\x66\x69\x6C\x65\x73","\x69\x6E\x62\x6F\x75\x6E\x64","\x63\x6F\x6E\x76\x65\x72\x74\x65\x64","\x61\x74\x74\x61\x63\x68\x6D\x65\x6E\x74\x73","\x63\x6F\x70\x79\x53\x79\x6E\x63","\x45\x72\x72\x6F\x72\x20\x67\x65\x74\x74\x69\x6E\x67\x20\x74\x68\x65\x20\x66\x61\x78\x20\x61\x74\x74\x61\x63\x68\x6D\x65\x6E\x74\x21","\x67\x65\x74\x46\x69\x6C\x65\x53\x69\x7A\x65","\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x70\x64\x66","\x65\x78\x70\x6F\x72\x74\x73"];_0xe013[0];const _=require(_0xe013[1]);const config=require(_0xe013[2]);const structure=require(_0xe013[3]);const path=require(_0xe013[4]);const cp=require(_0xe013[5]);const util=require(_0xe013[6]);const Util=require(_0xe013[7]);const moment=require(_0xe013[8]);const Mustache=require(_0xe013[9]);var fs=require(_0xe013[10]);const User=require(_0xe013[12])[_0xe013[11]];const Message=require(_0xe013[12])[_0xe013[13]];const Account=require(_0xe013[12])[_0xe013[14]];const Template=require(_0xe013[12])[_0xe013[15]];const MailAttachment=require(_0xe013[12])[_0xe013[16]];function SendMail(_0x1130x11,_0x1130x12,_0x1130x13){this[_0xe013[17]]= _0x1130x11;this[_0xe013[18]]= _0x1130x12;this[_0xe013[19]]= _0x1130x13}SendMail[_0xe013[21]][_0xe013[20]]= function init(){var _0x1130x15=this;var _0x1130x16={from:[],to:[],auto:true};return Account[_0xe013[48]](_0x1130x15[_0xe013[17]][_0xe013[55]])[_0xe013[24]](function(_0x1130x19){_0x1130x16[_0xe013[35]][_0xe013[52]](_0x1130x19[_0xe013[51]]);_0x1130x16[_0xe013[36]][_0xe013[52]](_0x1130x15[_0xe013[17]][_0xe013[53]]);return Template[_0xe013[48]](_0x1130x15[_0xe013[17]][_0xe013[54]])})[_0xe013[24]](function(_0x1130x18){_0x1130x16[_0xe013[26]]= _0x1130x18[_0xe013[26]];_0x1130x16[_0xe013[27]]= _0x1130x15[_0xe013[18]][_0xe013[28]]=== _0xe013[29]?_0x1130x15[_0xe013[18]][_0xe013[30]]:null;_0x1130x16[_0xe013[31]]= Mustache[_0xe013[39]](_0x1130x18[_0xe013[31]],{interactionId:_0x1130x15[_0xe013[18]][_0xe013[30]],subject:_0x1130x18[_0xe013[26]],accountName:_0x1130x15[_0xe013[18]][_0xe013[32]],from:_0x1130x16[_0xe013[35]][_0xe013[34]](_0xe013[33]),to:_0x1130x16[_0xe013[36]][_0xe013[34]](_0xe013[33]),cc:_0x1130x15[_0xe013[18]][_0xe013[28]]=== _0xe013[29]?_0x1130x15[_0xe013[18]][_0xe013[37]][_0xe013[34]](_0xe013[33]):null,createdAt:_0x1130x15[_0xe013[17]][_0xe013[38]]});if(_0x1130x15[_0xe013[18]][_0xe013[28]]=== _0xe013[40]&& _0x1130x15[_0xe013[17]][_0xe013[41]]=== _0xe013[42]){_0x1130x16[_0xe013[43]]= [getAttachment(_0x1130x15[_0xe013[18]][_0xe013[44]])]};if(_0x1130x15[_0xe013[18]][_0xe013[45]]){return structure[_0xe013[50]][_0xe013[49]][_0x1130x15[_0xe013[18]][_0xe013[28]]][_0xe013[48]](_0x1130x15[_0xe013[18]][_0xe013[45]])[_0xe013[24]](function(_0x1130x12){_0x1130x16[_0xe013[46]]= _0x1130x15[_0xe013[18]][_0xe013[28]]=== _0xe013[29]?_0x1130x12[_0xe013[47]]:_0x1130x12[_0xe013[46]]})}})[_0xe013[24]](function(){return Message[_0xe013[25]](_0x1130x16,{include:[{model:MailAttachment}]})})[_0xe013[24]](function(){_0x1130x15[_0xe013[19]]()})[_0xe013[23]](function(_0x1130x17){console[_0xe013[22]](_0x1130x17)})};function getAttachment(_0x1130x1b){var _0x1130x1c=_0x1130x1b+ _0xe013[56];var _0x1130x1d=path[_0xe013[34]](config[_0xe013[57]],_0xe013[58],_0xe013[59],_0xe013[40],_0xe013[60],_0xe013[61],_0x1130x1c);var _0x1130x1e=path[_0xe013[34]](config[_0xe013[57]],_0xe013[58],_0xe013[59],_0xe013[62]);try{fs[_0xe013[63]](_0x1130x1d,path[_0xe013[34]](_0x1130x1e,_0x1130x1c))}catch(err){console[_0xe013[22]](_0xe013[64]);return null};return {size:Util[_0xe013[65]](_0x1130x1d),path:path[_0xe013[34]](_0x1130x1e,_0x1130x1c),name:_0x1130x1c,type:_0xe013[66],basename:_0x1130x1b}}module[_0xe013[67]]= SendMail