Aggiornamento Ore
This commit is contained in:
@@ -67,6 +67,8 @@ module.exports = {
|
||||
if (transport) {
|
||||
paramemail.transport = transport;
|
||||
} else {
|
||||
paramemail.transport = this.getTransport(mylocalsconf);
|
||||
/*
|
||||
// console.log('1b . transport gmail');
|
||||
paramemail.transport = {
|
||||
service: 'gmail',
|
||||
@@ -74,9 +76,11 @@ module.exports = {
|
||||
user: tools.getEmailByIdApp(mylocalsconf.idapp),
|
||||
pass: tools.getPwdByIdApp(mylocalsconf.idapp)
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
// console.table(paramemail.transport);
|
||||
|
||||
// console.log('2 . paramemail.transport', paramemail.transport);
|
||||
// console.log('user', tools.getEmailByIdApp(mylocalsconf.idapp));
|
||||
// console.log('pass', tools.getPwdByIdApp(mylocalsconf.idapp));
|
||||
@@ -150,18 +154,18 @@ module.exports = {
|
||||
// },
|
||||
|
||||
getlinkReg: function (idapp, idreg) {
|
||||
strlinkreg = tools.getHostByIdApp(idapp) + process.env.LINKVERIF_REG + `?idapp=${idapp}&idlink=${idreg}`;
|
||||
const strlinkreg = tools.getHostByIdApp(idapp) + process.env.LINKVERIF_REG + `?idapp=${idapp}&idlink=${idreg}`;
|
||||
return strlinkreg;
|
||||
},
|
||||
getlinkRequestNewPassword: function (idapp, email, tokenforgot) {
|
||||
strlinkreg = tools.getHostByIdApp(idapp) + process.env.LINK_UPDATE_PASSWORD + `?idapp=${idapp}&email=${email}&tokenforgot=${tokenforgot}`;
|
||||
const strlinkreg = tools.getHostByIdApp(idapp) + process.env.LINK_UPDATE_PASSWORD + `?idapp=${idapp}&email=${email}&tokenforgot=${tokenforgot}`;
|
||||
return strlinkreg;
|
||||
},
|
||||
sendEmail_Registration: async function (lang, emailto, user, idapp, idreg) {
|
||||
|
||||
// console.log('idapp', idapp, tools.getNomeAppByIdApp(idapp));
|
||||
|
||||
mylocalsconf = {
|
||||
let mylocalsconf = {
|
||||
idapp,
|
||||
dataemail: await this.getdataemail(idapp),
|
||||
locale: lang,
|
||||
@@ -183,13 +187,15 @@ module.exports = {
|
||||
|
||||
await telegrambot.notifyToTelegram(telegrambot.phase.REGISTRATION, mylocalsconf);
|
||||
|
||||
tools.sendNotifToAdmin('Nuova Registrazione Utente: ' . name + ' ' + surname + ' (' + username + ')');
|
||||
|
||||
if (tools.isManagAndAdminDifferent(idapp)) {
|
||||
this.sendEmail_base('admin/registration/' + tools.LANGADMIN, tools.getManagerEmailByIdApp(idapp), mylocalsconf, '');
|
||||
}
|
||||
},
|
||||
sendEmail_RequestNewPassword: async function (lang, user, emailto, idapp, tokenforgot) {
|
||||
|
||||
mylocalsconf = {
|
||||
let mylocalsconf = {
|
||||
idapp,
|
||||
dataemail: await this.getdataemail(idapp),
|
||||
locale: lang,
|
||||
@@ -210,7 +216,7 @@ module.exports = {
|
||||
tools.mylog('sendEmail_Booking');
|
||||
tools.mylog('tools.getNomeAppByIdApp(idapp)', tools.getNomeAppByIdApp(idapp), idapp);
|
||||
|
||||
mylocalsconf = {
|
||||
let mylocalsconf = {
|
||||
idapp,
|
||||
dataemail: await this.getdataemail(idapp),
|
||||
locale: lang,
|
||||
@@ -262,7 +268,7 @@ module.exports = {
|
||||
|
||||
tools.mylog('sendEmail_CancelBooking');
|
||||
|
||||
mylocalsconf = {
|
||||
let mylocalsconf = {
|
||||
idapp,
|
||||
dataemail: await this.getdataemail(idapp),
|
||||
locale: lang,
|
||||
@@ -455,7 +461,7 @@ module.exports = {
|
||||
const baseurl = tools.getHostByIdApp(mylocalsconf.idapp);
|
||||
const urlunsibscribe = baseurl + '/unsubscribe?em=' + mylocalsconf.hashemail + '&mc=' + mylocalsconf.dataemail.mailchimpactive + '&email=' + mylocalsconf.emailto;
|
||||
|
||||
out = myvar.replace('{urlunsubscribe}', urlunsibscribe);
|
||||
let out = myvar.replace('{urlunsubscribe}', urlunsibscribe);
|
||||
out = out.replace('{email}', mylocalsconf.emailto);
|
||||
out = out.replace('{name}', mylocalsconf.name);
|
||||
out = out.replace('{surname}', mylocalsconf.surname);
|
||||
@@ -465,9 +471,9 @@ module.exports = {
|
||||
|
||||
replacefields: function (mylocalsconf) {
|
||||
try {
|
||||
mylocalsconf.dataemail.disclaimer_out = this.fieldsloop(mylocalsconf, mylocalsconf.dataemail.disclaimer);
|
||||
mylocalsconf.dataemail.disc_bottom_out = this.fieldsloop(mylocalsconf, mylocalsconf.dataemail.disc_bottom);
|
||||
mylocalsconf.dataemail.templ.testoheadermail_out = this.fieldsloop(mylocalsconf, mylocalsconf.dataemail.templ.testoheadermail);
|
||||
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.templ.testoheadermail_out = !!mylocalsconf.dataemail.templ.testoheadermail ? this.fieldsloop(mylocalsconf, mylocalsconf.dataemail.templ.testoheadermail) : '';
|
||||
} catch (e) {
|
||||
console.error('Error replacefields: ' + e)
|
||||
}
|
||||
@@ -515,12 +521,14 @@ module.exports = {
|
||||
smtpTransport = nodemailer.createTransport({
|
||||
host: mylocalsconf.dataemail.email_service,
|
||||
port: mylocalsconf.dataemail.email_port,
|
||||
secureConnection: false,
|
||||
tls: {cipher:'SSLv3'},
|
||||
auth: {
|
||||
user: mylocalsconf.dataemail.from,
|
||||
pass: mylocalsconf.dataemail.pwd_from
|
||||
}
|
||||
});
|
||||
} else if (mylocalsconf.dataemail.email_service === 'gmail' && mylocalsconf.dataemail.email_service !== undefined) {
|
||||
} else if (mylocalsconf.dataemail.email_service === 'gmail' && !!mylocalsconf.dataemail.pwd_from) {
|
||||
|
||||
//smtpTransport = {
|
||||
smtpTransport = nodemailer.createTransport({
|
||||
@@ -587,7 +595,7 @@ module.exports = {
|
||||
if (secpause < process.env.DELAY_SENDEMAIL)
|
||||
secpause = process.env.DELAY_SENDEMAIL;
|
||||
|
||||
activate = await Newstosent.isActivated(id_newstosent);
|
||||
const activate = await Newstosent.isActivated(id_newstosent);
|
||||
|
||||
if (!activate) {
|
||||
// Invio Newsletter Abortito!
|
||||
@@ -658,7 +666,7 @@ module.exports = {
|
||||
|
||||
} catch (e) {
|
||||
|
||||
activate = await Newstosent.isActivated(id_newstosent);
|
||||
const activate = await Newstosent.isActivated(id_newstosent);
|
||||
|
||||
if (!activate) {
|
||||
// Invio Newsletter Abortito!
|
||||
@@ -698,7 +706,7 @@ module.exports = {
|
||||
sendNewsletter: async function (rec, idapp) {
|
||||
if (rec) {
|
||||
// Start the job
|
||||
myjobnews = await Newstosent.findOne({ _id: rec._id });
|
||||
let myjobnews = await Newstosent.findOne({ _id: rec._id });
|
||||
if (!!myjobnews) {
|
||||
myjobnews.starting_job = true;
|
||||
myjobnews.datestartJob = new Date();
|
||||
@@ -748,8 +756,8 @@ module.exports = {
|
||||
testemailHtml: async function (idapp, lang, email, myuser) {
|
||||
|
||||
|
||||
mytitle = 'Prova msg'
|
||||
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> ';
|
||||
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');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user