Iscrizione Conacreis e Arcadei
This commit is contained in:
29
emails/iscrizione_arcadei/it/html.pug
Executable file
29
emails/iscrizione_arcadei/it/html.pug
Executable file
@@ -0,0 +1,29 @@
|
||||
p Ciao #{name},<br>Grazie per aver inviato la tua richiesta di adesione come Sostenitore di Arcadei !
|
||||
p Cordiali Saluti<br>Arcadei
|
||||
|
||||
style(type="text/css").
|
||||
html, body {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
p {
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.divbtn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.btn-lg {
|
||||
padding: 5px;
|
||||
margin: 5px;
|
||||
font-size: 26px;
|
||||
cursor: pointer;
|
||||
color: white;
|
||||
background: #027be3 !important;
|
||||
border-radius: 28px;
|
||||
|
||||
}
|
||||
1
emails/iscrizione_arcadei/it/subject.pug
Executable file
1
emails/iscrizione_arcadei/it/subject.pug
Executable file
@@ -0,0 +1 @@
|
||||
=`Richiesta di Adesione ad Arcadei (${name} ${surname})`
|
||||
@@ -5,7 +5,7 @@ require('./config/config');
|
||||
|
||||
const Email = require('email-templates');
|
||||
|
||||
const i18n = require("i18n");
|
||||
const i18n = require('i18n');
|
||||
|
||||
const {ObjectID} = require('mongodb');
|
||||
const {Settings} = require('./models/settings');
|
||||
@@ -13,7 +13,7 @@ const { TemplEmail } = require('./models/templemail');
|
||||
const {Discipline} = require('./models/discipline');
|
||||
|
||||
const previewEmail = require('preview-email');
|
||||
const nodemailer = require("nodemailer");
|
||||
const nodemailer = require('nodemailer');
|
||||
|
||||
const OrdersCart = require('./models/orderscart');
|
||||
|
||||
@@ -28,15 +28,14 @@ const shared_consts = require('./tools/shared_nodejs');
|
||||
const {User} = require('./models/user');
|
||||
|
||||
const transport_preview = nodemailer.createTransport({
|
||||
jsonTransport: true
|
||||
jsonTransport: true,
|
||||
});
|
||||
|
||||
function checkifSendEmail() {
|
||||
return process.env.SEND_EMAIL === "1";
|
||||
return process.env.SEND_EMAIL === '1';
|
||||
//return false;
|
||||
}
|
||||
|
||||
|
||||
module.exports = {
|
||||
sendEmail_base_e_manager: function(idapp, template, to, mylocalsconf, replyTo, transport, previewonly) {
|
||||
this.sendEmail_base(template, to, mylocalsconf, replyTo, transport, previewonly);
|
||||
@@ -53,7 +52,7 @@ module.exports = {
|
||||
sendEmail_base: function(template, to, mylocalsconf, replyTo, transport, previewonly) {
|
||||
|
||||
if (to === '')
|
||||
return false
|
||||
return false;
|
||||
// console.log('mylocalsconf', mylocalsconf);
|
||||
|
||||
// console.log("check EMAIL :" + checkifSendEmail());
|
||||
@@ -65,8 +64,8 @@ module.exports = {
|
||||
message: {
|
||||
from: mylocalsconf.dataemail.from, // sender address
|
||||
headers: {
|
||||
'Reply-To': replyTo
|
||||
}
|
||||
'Reply-To': replyTo,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -111,21 +110,18 @@ module.exports = {
|
||||
|
||||
console.log(' *** Invia Email a ' + to, 'template', template);
|
||||
|
||||
return email
|
||||
.send({
|
||||
return email.send({
|
||||
template: template,
|
||||
message: {
|
||||
to: to,
|
||||
},
|
||||
locals: mylocalsconf,
|
||||
})
|
||||
.then((ris) => {
|
||||
}).then((ris) => {
|
||||
// console.log('ris EMAIL', ris);
|
||||
return !!ris
|
||||
})
|
||||
.catch((err) => {
|
||||
return !!ris;
|
||||
}).catch((err) => {
|
||||
console.error('sendEmail_base Error: ', err);
|
||||
return false
|
||||
return false;
|
||||
});
|
||||
},
|
||||
|
||||
@@ -141,24 +137,23 @@ module.exports = {
|
||||
html: html,
|
||||
};
|
||||
|
||||
|
||||
if (replyTo)
|
||||
mailOptions['reply-to'] = replyTo;
|
||||
|
||||
const smtpTransport = this.getTransport(mylocalsconf);
|
||||
|
||||
if (process.env.SEND_EMAIL === "1") {
|
||||
if (process.env.SEND_EMAIL === '1') {
|
||||
// console.log("SEND EMAIL...");
|
||||
// send mail with defined transport object
|
||||
smtpTransport.sendMail(mailOptions, function(error, response) {
|
||||
if (error) {
|
||||
console.log("Email Inviata ERRORE RISPOSTA: " + error);
|
||||
console.log('Email Inviata ERRORE RISPOSTA: ' + error);
|
||||
} else {
|
||||
// console.log("Email Inviata RISPOSTA: " + response);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (process.env.PROVA_EMAIL_TEMPLATE !== "1")
|
||||
if (process.env.PROVA_EMAIL_TEMPLATE !== '1')
|
||||
previewEmail(mailOptions).then(console.log).catch(console.error);
|
||||
else
|
||||
transport_preview.sendMail(mailOptions).then(console.log).catch(console.error);
|
||||
@@ -228,7 +223,7 @@ module.exports = {
|
||||
emailto: emailto,
|
||||
iscritto,
|
||||
metodo_pagamento: tools.getPaymentTypesById(iscritto.metodo_pagamento),
|
||||
data_nascita: tools.getstrDate_DD_MM_YYYY(iscritto.dateofbirth)
|
||||
data_nascita: tools.getstrDate_DD_MM_YYYY(iscritto.dateofbirth),
|
||||
};
|
||||
|
||||
mylocalsconf = this.setParamsForTemplate(iscritto, mylocalsconf);
|
||||
@@ -250,6 +245,7 @@ module.exports = {
|
||||
sendEmail_IscrizioneArcadei: async function(lang, emailto, iscritto, idapp) {
|
||||
|
||||
// console.log('idapp', idapp, tools.getNomeAppByIdApp(idapp));
|
||||
try {
|
||||
|
||||
let mylocalsconf = {
|
||||
idapp,
|
||||
@@ -260,7 +256,7 @@ module.exports = {
|
||||
emailto: emailto,
|
||||
iscritto,
|
||||
metodo_pagamento: tools.getPaymentTypesById(iscritto.metodo_pagamento),
|
||||
data_nascita: tools.getstrDate_DD_MM_YYYY(iscritto.dateofbirth)
|
||||
data_nascita: tools.getstrDate_DD_MM_YYYY(iscritto.dateofbirth),
|
||||
};
|
||||
|
||||
mylocalsconf = this.setParamsForTemplate(iscritto, mylocalsconf);
|
||||
@@ -277,6 +273,9 @@ module.exports = {
|
||||
if (tools.isManagAndAdminDifferent(idapp)) {
|
||||
this.sendEmail_base('admin/iscrizione_arcadei/' + tools.LANGADMIN, tools.getManagerEmailByIdApp(idapp), mylocalsconf, '');
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Err', e);
|
||||
}
|
||||
},
|
||||
|
||||
sendEmail_RequestNewPassword: async function(lang, user, emailto, idapp, tokenforgot) {
|
||||
@@ -300,7 +299,6 @@ module.exports = {
|
||||
tools.mylog('sendEmail_Booking');
|
||||
tools.mylog('tools.getNomeAppByIdApp(idapp)', tools.getNomeAppByIdApp(idapp), idapp);
|
||||
|
||||
|
||||
let mylocalsconf = {
|
||||
idapp,
|
||||
dataemail: await this.getdataemail(idapp),
|
||||
@@ -318,8 +316,7 @@ module.exports = {
|
||||
|
||||
mylocalsconf = this.setParamsForTemplate(user, mylocalsconf);
|
||||
|
||||
return await Settings.getValDbSettings(idapp, 'MSG_REPLY_AFTER_BOOKING')
|
||||
.then(async (ris) => {
|
||||
return await Settings.getValDbSettings(idapp, 'MSG_REPLY_AFTER_BOOKING').then(async (ris) => {
|
||||
mylocalsconf.msgreply_after_booking = ris;
|
||||
|
||||
mylocalsconf = await this.preparaConfPerBooking(res, idapp, mylocalsconf, recbooking, 'Prenotazione');
|
||||
@@ -346,33 +343,35 @@ module.exports = {
|
||||
preparaConfPerBooking: async function(res, idapp, mylocalsconf, recbooking, title) {
|
||||
|
||||
let texthtml = '';
|
||||
let msgtelegram = title + ' Evento [' + mylocalsconf.username + ' (' + mylocalsconf.name + ' ' + mylocalsconf.surname + ')] ' + mylocalsconf.eventtextplain;
|
||||
let msgtelegram = title + ' Evento [' + mylocalsconf.username + ' (' + mylocalsconf.name + ' ' + mylocalsconf.surname + ')] ' +
|
||||
mylocalsconf.eventtextplain;
|
||||
if (recbooking.modified) {
|
||||
msgtelegram += ' (modificato) '
|
||||
msgtelegram += ' (modificato) ';
|
||||
} else {
|
||||
msgtelegram += ' (Nuovo)'
|
||||
msgtelegram += ' (Nuovo)';
|
||||
}
|
||||
|
||||
msgtelegram += '\n';
|
||||
|
||||
if (recbooking.numpeople > 0) {
|
||||
mylocalsconf.participants = recbooking.numpeople.toString() + ' ' + tools.getres__('partecipanti', res);
|
||||
msgtelegram += mylocalsconf.participants + '\n'
|
||||
msgtelegram += mylocalsconf.participants + '\n';
|
||||
}
|
||||
|
||||
if (recbooking.numpeopleLunch > 0) {
|
||||
mylocalsconf.participantsLunch = recbooking.numpeopleLunch.toString() + ' ' + tools.getres__('partecipanti a Pranzo', res);
|
||||
msgtelegram += mylocalsconf.participantsLunch + '\n'
|
||||
msgtelegram += mylocalsconf.participantsLunch + '\n';
|
||||
}
|
||||
|
||||
if (recbooking.numpeopleDinner > 0) {
|
||||
mylocalsconf.participantsDinner = recbooking.numpeopleDinner.toString() + ' ' + tools.getres__('partecipanti a Cena', res);
|
||||
msgtelegram += mylocalsconf.participantsDinner + '\n'
|
||||
msgtelegram += mylocalsconf.participantsDinner + '\n';
|
||||
}
|
||||
|
||||
if (recbooking.numpeopleDinnerShared > 0) {
|
||||
mylocalsconf.participantsDinnerShared = recbooking.numpeopleDinnerShared.toString() + ' ' + tools.getres__('partecipanti a Cena Condivisa', res);
|
||||
msgtelegram += mylocalsconf.participantsDinnerShared + '\n'
|
||||
mylocalsconf.participantsDinnerShared = recbooking.numpeopleDinnerShared.toString() + ' ' +
|
||||
tools.getres__('partecipanti a Cena Condivisa', res);
|
||||
msgtelegram += mylocalsconf.participantsDinnerShared + '\n';
|
||||
}
|
||||
|
||||
telegrambot.sendMsgTelegramToTheManagers(idapp, msgtelegram);
|
||||
@@ -404,7 +403,8 @@ module.exports = {
|
||||
|
||||
mylocalsconf = await this.preparaConfPerBooking(res, idapp, mylocalsconf, recbooking, 'Cancellazione');
|
||||
|
||||
let msgtelegram = 'Cancellazione Evento [' + mylocalsconf.name + ' (' + mylocalsconf.name + ' ' + mylocalsconf.surname + ')] ' + mylocalsconf.eventtextplain;
|
||||
let msgtelegram = 'Cancellazione Evento [' + mylocalsconf.name + ' (' + mylocalsconf.name + ' ' + mylocalsconf.surname + ')] ' +
|
||||
mylocalsconf.eventtextplain;
|
||||
|
||||
telegrambot.sendMsgTelegramToTheManagers(idapp, msgtelegram);
|
||||
|
||||
@@ -431,7 +431,7 @@ module.exports = {
|
||||
usernameorig: user.name + ' ' + user.surname,
|
||||
message: tools.convertTexttoHtml(recmsg.message),
|
||||
infoevent: recmsg.source.infoevent,
|
||||
strlinkreply: tools.getHostByIdApp(idapp) + '/messages/' + recmsg._id
|
||||
strlinkreply: tools.getHostByIdApp(idapp) + '/messages/' + recmsg._id,
|
||||
};
|
||||
|
||||
mylocalsconf = this.setParamsForTemplate(user, mylocalsconf);
|
||||
@@ -530,7 +530,7 @@ module.exports = {
|
||||
name: mylocalsconf.name,
|
||||
surname: mylocalsconf.surname,
|
||||
email: mylocalsconf.emailto,
|
||||
hash
|
||||
hash,
|
||||
});
|
||||
myperson._id = new ObjectID();
|
||||
} else {
|
||||
@@ -556,13 +556,13 @@ module.exports = {
|
||||
}
|
||||
}
|
||||
|
||||
return { code: server_constants.RIS_SUBSCRIBED_OK, msg: server_constants.RIS_SUBSCRIBED_MSG[lang] }
|
||||
return {code: server_constants.RIS_SUBSCRIBED_OK, msg: server_constants.RIS_SUBSCRIBED_MSG[lang]};
|
||||
} else {
|
||||
// Already Esist
|
||||
return {
|
||||
code: server_constants.RIS_SUBSCRIBED_ALREADYEXIST,
|
||||
msg: server_constants.RIS_SUBSCRIBED_MSG_ALREADYEXIST[lang]
|
||||
}
|
||||
msg: server_constants.RIS_SUBSCRIBED_MSG_ALREADYEXIST[lang],
|
||||
};
|
||||
}
|
||||
|
||||
},
|
||||
@@ -576,34 +576,35 @@ module.exports = {
|
||||
return {
|
||||
myperson: null,
|
||||
code: server_constants.RIS_UNSUBSCRIBED_ALREADY_DONE,
|
||||
msg: server_constants.RIS_UNSUBSCRIBED_MSG_ALREADY_DONE[lang]
|
||||
}
|
||||
msg: server_constants.RIS_UNSUBSCRIBED_MSG_ALREADY_DONE[lang],
|
||||
};
|
||||
}
|
||||
|
||||
const fields_to_update = {
|
||||
statesub: false
|
||||
statesub: false,
|
||||
};
|
||||
let myperson = await MailingList.findOneAndUpdate({
|
||||
idapp,
|
||||
hash: hashemail
|
||||
hash: hashemail,
|
||||
}, {$set: fields_to_update}, {new: false});
|
||||
if (myperson) {
|
||||
return { myperson, code: server_constants.RIS_UNSUBSCRIBED_OK, msg: '' }
|
||||
return {myperson, code: server_constants.RIS_UNSUBSCRIBED_OK, msg: ''};
|
||||
|
||||
} else {
|
||||
// Not found !
|
||||
return {
|
||||
myperson: null,
|
||||
code: server_constants.RIS_UNSUBSCRIBED_NOT_EXIST,
|
||||
msg: server_constants.RIS_UNSUBSTR_NOT_EXIST[lang]
|
||||
}
|
||||
msg: server_constants.RIS_UNSUBSTR_NOT_EXIST[lang],
|
||||
};
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
fieldsloop: function(mylocalsconf, myvar) {
|
||||
const baseurl = tools.getHostByIdApp(mylocalsconf.idapp);
|
||||
const urlunsibscribe = baseurl + '/unsubscribe?em=' + mylocalsconf.hashemail + '&mc=' + mylocalsconf.dataemail.mailchimpactive + '&email=' + mylocalsconf.emailto;
|
||||
const urlunsibscribe = baseurl + '/unsubscribe?em=' + mylocalsconf.hashemail + '&mc=' + mylocalsconf.dataemail.mailchimpactive +
|
||||
'&email=' + mylocalsconf.emailto;
|
||||
|
||||
let out = myvar.replace('{urlunsubscribe}', urlunsibscribe);
|
||||
out = out.replace('{email}', mylocalsconf.emailto);
|
||||
@@ -612,20 +613,23 @@ module.exports = {
|
||||
out = out.replace('{surname}', mylocalsconf.surname ? mylocalsconf.surname : '');
|
||||
out = out.replace('{aportador_solidario}', mylocalsconf.aportador_solidario ? mylocalsconf.aportador_solidario : '');
|
||||
|
||||
return out
|
||||
return out;
|
||||
},
|
||||
|
||||
replacefields: function(mylocalsconf) {
|
||||
try {
|
||||
mylocalsconf.dataemail.disclaimer_out = !!mylocalsconf.dataemail.disclaimer ? this.fieldsloop(mylocalsconf, mylocalsconf.dataemail.disclaimer) : '';
|
||||
mylocalsconf.dataemail.disc_bottom_out = !!mylocalsconf.dataemail.disc_bottom ? this.fieldsloop(mylocalsconf, mylocalsconf.dataemail.disc_bottom) : '';
|
||||
mylocalsconf.dataemail.disclaimer_out = !!mylocalsconf.dataemail.disclaimer ? this.fieldsloop(mylocalsconf,
|
||||
mylocalsconf.dataemail.disclaimer) : '';
|
||||
mylocalsconf.dataemail.disc_bottom_out = !!mylocalsconf.dataemail.disc_bottom ? this.fieldsloop(mylocalsconf,
|
||||
mylocalsconf.dataemail.disc_bottom) : '';
|
||||
if (mylocalsconf.dataemail.templ)
|
||||
mylocalsconf.dataemail.templ.testoheadermail_out = !!mylocalsconf.dataemail.templ.testoheadermail ? this.fieldsloop(mylocalsconf, mylocalsconf.dataemail.templ.testoheadermail) : '';
|
||||
mylocalsconf.dataemail.templ.testoheadermail_out = !!mylocalsconf.dataemail.templ.testoheadermail ? this.fieldsloop(mylocalsconf,
|
||||
mylocalsconf.dataemail.templ.testoheadermail) : '';
|
||||
} catch (e) {
|
||||
console.error('Error replacefields: ' + e)
|
||||
console.error('Error replacefields: ' + e);
|
||||
}
|
||||
|
||||
return mylocalsconf
|
||||
return mylocalsconf;
|
||||
},
|
||||
|
||||
getdataemail: async (idapp) => {
|
||||
@@ -657,7 +661,7 @@ module.exports = {
|
||||
mydata.templ = await TemplEmail.findOne({_id: mydata.templemail_id});
|
||||
// console.log(mydata.templ);
|
||||
|
||||
return mydata
|
||||
return mydata;
|
||||
},
|
||||
|
||||
getTransport: (mylocalsconf) => {
|
||||
@@ -666,7 +670,8 @@ module.exports = {
|
||||
|
||||
// console.log('mylocalsconf.dataemail', mylocalsconf.dataemail);
|
||||
|
||||
if (mylocalsconf.dataemail.email_service !== 'gmail' && mylocalsconf.dataemail.email_service !== undefined && mylocalsconf.dataemail.email_service !== "") {
|
||||
if (mylocalsconf.dataemail.email_service !== 'gmail' && mylocalsconf.dataemail.email_service !== undefined &&
|
||||
mylocalsconf.dataemail.email_service !== '') {
|
||||
smtpTransport = nodemailer.createTransport({
|
||||
host: mylocalsconf.dataemail.email_service,
|
||||
port: mylocalsconf.dataemail.email_port,
|
||||
@@ -674,8 +679,8 @@ module.exports = {
|
||||
tls: {cipher: 'SSLv3'},
|
||||
auth: {
|
||||
user: mylocalsconf.dataemail.from,
|
||||
pass: tools.decryptdata(mylocalsconf.dataemail.pwd_from)
|
||||
}
|
||||
pass: tools.decryptdata(mylocalsconf.dataemail.pwd_from),
|
||||
},
|
||||
});
|
||||
} else if (mylocalsconf.dataemail.email_service === 'gmail' && !!mylocalsconf.dataemail.pwd_from) {
|
||||
|
||||
@@ -684,8 +689,8 @@ module.exports = {
|
||||
service: 'gmail', //'Gmail',
|
||||
auth: {
|
||||
user: mylocalsconf.dataemail.from,
|
||||
pass: tools.decryptdata(mylocalsconf.dataemail.pwd_from)
|
||||
}
|
||||
pass: tools.decryptdata(mylocalsconf.dataemail.pwd_from),
|
||||
},
|
||||
});
|
||||
} else {
|
||||
// smtpTransport = {
|
||||
@@ -693,8 +698,8 @@ module.exports = {
|
||||
service: 'gmail',
|
||||
auth: {
|
||||
user: tools.getEmailByIdApp(mylocalsconf.idapp),
|
||||
pass: tools.getPwdByIdApp(mylocalsconf.idapp)
|
||||
}
|
||||
pass: tools.getPwdByIdApp(mylocalsconf.idapp),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -737,12 +742,13 @@ module.exports = {
|
||||
baseurl: tools.getHostByIdApp(idapp),
|
||||
dataemail: await this.getdataemail(idapp),
|
||||
ordernumber: orders.numorder,
|
||||
user
|
||||
user,
|
||||
};
|
||||
|
||||
mylocalsconf = this.setParamsForTemplate(user, mylocalsconf);
|
||||
|
||||
this.sendEmail_base_e_manager(idapp, 'ecommerce/makeorder/' + lang, mylocalsconf.emailto, mylocalsconf, mylocalsconf.dataemail.email_reply);
|
||||
this.sendEmail_base_e_manager(idapp, 'ecommerce/makeorder/' + lang, mylocalsconf.emailto, mylocalsconf,
|
||||
mylocalsconf.dataemail.email_reply);
|
||||
|
||||
},
|
||||
sendEmail_Order: async function(lang, idapp, orders, user, ordertype, status) {
|
||||
@@ -760,13 +766,14 @@ module.exports = {
|
||||
baseurl: tools.getHostByIdApp(idapp),
|
||||
dataemail: await this.getdataemail(idapp),
|
||||
ordernumber: orders.numorder,
|
||||
user
|
||||
user,
|
||||
};
|
||||
|
||||
mylocalsconf = this.setParamsForTemplate(user, mylocalsconf);
|
||||
|
||||
if ((status !== shared_consts.OrderStatus.CANCELED) && (status !== shared_consts.OrderStatus.RECEIVED)) {
|
||||
const esito = this.sendEmail_base('ecommerce/' + ordertype + '/' + lang, mylocalsconf.emailto, mylocalsconf, mylocalsconf.dataemail.email_reply);
|
||||
const esito = this.sendEmail_base('ecommerce/' + ordertype + '/' + lang, mylocalsconf.emailto, mylocalsconf,
|
||||
mylocalsconf.dataemail.email_reply);
|
||||
|
||||
this.sendEmail_base('ecommerce/' + ordertype + '/' + lang, tools.getAdminEmailByIdApp(idapp), mylocalsconf, '');
|
||||
|
||||
@@ -795,7 +802,7 @@ module.exports = {
|
||||
nomeapp: tools.getNomeAppByIdApp(idapp),
|
||||
arrevents: myarrevents,
|
||||
baseurl: tools.getHostByIdApp(idapp),
|
||||
dataemail: await this.getdataemail(idapp)
|
||||
dataemail: await this.getdataemail(idapp),
|
||||
};
|
||||
|
||||
await Newstosent.processingJob(id_newstosent, true);
|
||||
@@ -829,7 +836,7 @@ module.exports = {
|
||||
await mynewsrec.save();
|
||||
await Newstosent.processingJob(id_newstosent, false);
|
||||
console.log('*** L\'Invio della Newsletter è stato fermato ! ');
|
||||
return false
|
||||
return false;
|
||||
}
|
||||
|
||||
mylocalsconf = this.setParamsForTemplate(user, mylocalsconf);
|
||||
@@ -843,7 +850,8 @@ module.exports = {
|
||||
|
||||
// Send Email to the User
|
||||
// console.log('-> Invio Email (', mynewsrec.numemail_sent, '/', mynewsrec.numemail_tot, ')');
|
||||
const esito = this.sendEmail_base('newsletter/' + lang, mylocalsconf.emailto, mylocalsconf, mylocalsconf.dataemail.email_reply, smtpTransport);
|
||||
const esito = this.sendEmail_base('newsletter/' + lang, mylocalsconf.emailto, mylocalsconf,
|
||||
mylocalsconf.dataemail.email_reply, smtpTransport);
|
||||
|
||||
if ((mynewsrec.numemail_sent % 100) === 0) {
|
||||
const msgproc = 'In Corso ' + mynewsrec.numemail_sent + ' / ' + mynewsrec.numemail_tot + ' Email inviate...';
|
||||
@@ -853,10 +861,9 @@ module.exports = {
|
||||
//Put the result in the database, to check if is sent or not.
|
||||
const updateml = await MailingList.findOneAndUpdate({
|
||||
idapp,
|
||||
email: user.email
|
||||
email: user.email,
|
||||
}, {$set: {lastid_newstosent: ObjectID(id_newstosent)}}, {new: false});
|
||||
|
||||
|
||||
//Delay for send email...
|
||||
await tools.snooze(secpause);
|
||||
|
||||
@@ -894,18 +901,16 @@ module.exports = {
|
||||
await mynewsrec.save();
|
||||
await Newstosent.processingJob(id_newstosent, false);
|
||||
console.log('*** L\'Invio della Newsletter è stato fermato ! ');
|
||||
return false
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
|
||||
checkifSentNewsletter: async function(idapp) {
|
||||
// Check if is the time to send the Newsletter
|
||||
|
||||
return await Newstosent.findNewsletter_To_Send(idapp)
|
||||
.then((rec) => {
|
||||
return await Newstosent.findNewsletter_To_Send(idapp).then((rec) => {
|
||||
if (rec)
|
||||
this.sendNewsletter(rec);
|
||||
});
|
||||
@@ -916,9 +921,8 @@ module.exports = {
|
||||
// Check if is the time to send the Newsletter
|
||||
// Only newsletter pending en 8 hour last email sent.
|
||||
|
||||
return await Newstosent.findNewsletterPending_To_Send(idapp)
|
||||
.then((rec) => { //
|
||||
this.sendNewsletter(rec, idapp)
|
||||
return await Newstosent.findNewsletterPending_To_Send(idapp).then((rec) => { //
|
||||
this.sendNewsletter(rec, idapp);
|
||||
});
|
||||
},
|
||||
|
||||
@@ -930,12 +934,10 @@ module.exports = {
|
||||
myjobnews.starting_job = true;
|
||||
myjobnews.datestartJob = new Date();
|
||||
|
||||
myjobnews.save()
|
||||
.then((ris) => {
|
||||
myjobnews.save().then((ris) => {
|
||||
|
||||
this.sendEmail_Newsletter_Events("it", idapp, rec._id);
|
||||
})
|
||||
.catch((e) => {
|
||||
this.sendEmail_Newsletter_Events('it', idapp, rec._id);
|
||||
}).catch((e) => {
|
||||
console.error(e.message);
|
||||
});
|
||||
}
|
||||
@@ -979,8 +981,7 @@ module.exports = {
|
||||
|
||||
testemailHtml: async function(idapp, lang, email, myuser) {
|
||||
|
||||
|
||||
let mytitle = 'Prova msg'
|
||||
let mytitle = 'Prova msg';
|
||||
let messaggio = '<br><b>Ciao!</b><div>Come stai?</div><br>Tutto Bene?<br><a href="https://ayni.gifteconomy.app/">Prova Link</a><br><i>Corsivo</i></i> ';
|
||||
|
||||
/*const htmlToText = require('html-to-text');
|
||||
@@ -994,11 +995,10 @@ module.exports = {
|
||||
|
||||
return await this.sendEmail_ByText(lang, email, myuser, idapp, {
|
||||
emailbody: messaggio,
|
||||
emailtitle: mytitle
|
||||
emailtitle: mytitle,
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
}
|
||||
;
|
||||
|
||||
@@ -3,10 +3,10 @@ const tools = require('../tools/general');
|
||||
const appTelegram = [tools.FREEPLANET, tools.RISO];
|
||||
|
||||
const appTelegram_TEST = [tools.FREEPLANET, tools.ARCADEI, tools.RISO];
|
||||
const appTelegram_DEVELOP = [tools.RISO];
|
||||
const appTelegram_DEVELOP = [tools.RISO, tools.FREEPLANET];
|
||||
|
||||
const appTelegramFinti = ['2', tools.CNM];
|
||||
const appTelegramDest = [tools.FREEPLANET, tools.FREEPLANET];
|
||||
const appTelegramFinti = ['2', tools.CNM, tools.ARCADEI];
|
||||
const appTelegramDest = [tools.FREEPLANET, tools.FREEPLANET, tools.FREEPLANET];
|
||||
|
||||
const printf = require('util').format;
|
||||
|
||||
@@ -269,8 +269,8 @@ const Menu = {
|
||||
'Inv e NO 7 Req',
|
||||
MSGSTAFF: emoji.get('incoming_envelope') + ' Invia a STAFF',
|
||||
MSGPAOLO: emoji.get('incoming_envelope') + ' Invia a PAOLO',
|
||||
RESTART_SRV: emoji.get('incoming_envelope') + 'RestartServer',
|
||||
REBOOT_SRV: emoji.get('incoming_envelope') + 'RebootServer',
|
||||
RESTART_SRV: emoji.get('incoming_envelope') + 'Restart-NodeJs',
|
||||
REBOOT_SRV: emoji.get('incoming_envelope') + 'Reboot-VPS!',
|
||||
EXECSH: emoji.get('incoming_envelope') + 'ExecSH',
|
||||
LOG_SRV: '🖥Logserver.sh',
|
||||
MSGATUTTI: emoji.get('incoming_envelope') + ' Invia a TUTTI',
|
||||
@@ -504,8 +504,8 @@ const txt = {
|
||||
MSG_APORTADOR_DEST_NOT_CONFIRMED: emo.EXCLAMATION_MARK +
|
||||
'🚫 Ci dispiace ma non sei stato Verificato correttamente dal tuo invitante %s.<br>Contattalo per farti abilitare !',
|
||||
MSG_APORTADOR_NOT_CONFIRMED: emo.EXCLAMATION_MARK + '🚫 %s Non è stato Abilitato !',
|
||||
MSG_ISCRITTO_CONACREIS: emo.FIRE + '[%] Si è appena Iscritto al Conacreis "%s"',
|
||||
MSG_ISCRITTO_ARCADEI: emo.FIRE + '[%] Si è appena Iscritto ad Arcadei "%s"',
|
||||
MSG_ISCRITTO_CONACREIS: emo.FIRE + '[%s] Si è appena Iscritto al Conacreis "%s"',
|
||||
MSG_ISCRITTO_ARCADEI: emo.FIRE + '[%s] Si è appena Iscritto ad Arcadei "%s"',
|
||||
MSG_MSG_SENT: emoji.get('envelope') + ' Messaggi Inviati !',
|
||||
MSG_MSG_TOSENT: emoji.get('envelope') + ' Messaggi da Inviare',
|
||||
MSG_MSG_INCORSO: emoji.get('envelope') + ' messaggi in corso... Inviati attualmente',
|
||||
@@ -813,7 +813,7 @@ const MyTelegramBot = {
|
||||
|
||||
let nomeapp = tools.getHostByIdApp(mylocalsconf.idapp);
|
||||
|
||||
let text = printf(getstr(langdest, msg), nomeapp, NameFrom);
|
||||
let text = printf(getstr(langdest, msg), NameFrom, nomeapp);
|
||||
|
||||
let addtext = '';
|
||||
|
||||
|
||||
@@ -412,8 +412,8 @@ module.exports = {
|
||||
FREEPLANET: '1',
|
||||
AYNI: '7',
|
||||
CNM: '10',
|
||||
ARCADEI: '14',
|
||||
RISO: '13',
|
||||
ARCADEI: '15',
|
||||
|
||||
HELP_CHAT: '',
|
||||
TYPECONF_ZOOM: 'zoom',
|
||||
|
||||
Reference in New Issue
Block a user