- Tolto Zoom e Sogni come requisiti

- Corretto Email con HTML che si visualizzavano tutti i caratteri HTML...
This commit is contained in:
Paolo Arena
2020-09-15 11:49:20 +02:00
parent f16631dad3
commit 0ac4a16715
7 changed files with 72 additions and 117 deletions

View File

@@ -502,7 +502,7 @@ UserSchema.statics.getUserShortDataByUsername = async function (idapp, username)
sospeso: 1,
verified_email: 1,
'profile.teleg_id': 1,
'profile.saw_zoom_presentation': 1,
// 'profile.saw_zoom_presentation': 1,
'profile.ask_zoom_partecipato': 1,
'profile.qualified': 1,
'profile.qualified_2invitati': 1,
@@ -513,7 +513,7 @@ UserSchema.statics.getUserShortDataByUsername = async function (idapp, username)
'profile.revolut': 1,
'profile.link_payment': 1,
'profile.note_payment': 1,
'profile.my_dream': 1,
// 'profile.my_dream': 1,
'profile.paymenttypes': 1,
'profile.cell': 1,
made_gift: 1,
@@ -556,7 +556,7 @@ UserSchema.statics.getDownlineByUsername = async function (idapp, username, incl
surname: 1,
verified_email: 1,
'profile.teleg_id': 1,
'profile.saw_zoom_presentation': 1,
// 'profile.saw_zoom_presentation': 1,
'profile.ask_zoom_partecipato': 1,
'profile.qualified': 1,
'profile.qualified_2invitati': 1,
@@ -567,7 +567,7 @@ UserSchema.statics.getDownlineByUsername = async function (idapp, username, incl
'profile.revolut': 1,
'profile.link_payment': 1,
'profile.note_payment': 1,
'profile.my_dream': 1,
// 'profile.my_dream': 1,
'profile.paymenttypes': 1,
'profile.cell': 1,
made_gift: 1,
@@ -641,7 +641,7 @@ UserSchema.statics.getQueryQualified = function () {
verified_email: true,
'profile.teleg_id': { $gt: 1 },
'profile.saw_and_accepted': shared_consts.ALL_SAW_AND_ACCEPTED,
'profile.saw_zoom_presentation': true,
// 'profile.saw_zoom_presentation': true,
$or: [
{ 'profile.link_payment': { $exists: true } },
{ 'profile.email_paypal': { $exists: true } },

View File

@@ -63,7 +63,6 @@ const shared_consts = require('../tools/shared_nodejs');
UserCost = {
FIELDS_REQUISITI: ['verified_email',
'profile.teleg_id',
'profile.saw_zoom_presentation',
'profile.saw_and_accepted',
'profile.revolut',
'profile.payeer_id',
@@ -463,13 +462,13 @@ router.patch('/chval', authenticate, async (req, res) => {
}
if (mydata.table === 'users') {
if ('saw_zoom_presentation' in fieldsvalue) {
/*if ('saw_zoom_presentation' in fieldsvalue) {
if (fieldsvalue['saw_zoom_presentation']) {
const messaggio = tools.get__('ZOOM_CONFERMATO');
await telegrambot.sendMsgTelegram(idapp, myuser.username, messaggio);
await telegrambot.sendMsgTelegramToTheManagersAndZoomeri(idapp, `L\'utente ${rec.name} ${rec.surname} (${rec.username}) è stato confermato per aver visto lo Zoom di Benvenuto`);
}
}
}*/
if ('aportador_solidario' in fieldsvalue) {
ind_order_ingr = mydata.ind_order_ingr;

View File

@@ -347,7 +347,16 @@ router.post('/testemail', authenticate, async (req, res) => {
lang = req.body.locale;
previewonly = req.body.previewonly;
const ris = await sendemail.testemail(idapp, lang, previewonly);
const test = true;
if (test) {
const email = 'pao.loarena77@gmail.com';
const myuser = await User.findOne({ idapp, email });
const ris = await sendemail.testemailHtml(idapp, lang, email, myuser);
} else {
const ris = await sendemail.testemail(idapp, lang, previewonly);
}
if (ris)
return res.send({ code: server_constants.RIS_CODE_OK, msg: '' });

View File

@@ -163,9 +163,9 @@ router.post('/', async (req, res) => {
recorig = await User.findByCellAndNameSurname(user.idapp, user.profile.cell, user.name.slice(0, -1), user.surname);
if (!!recorig) {
user.profile.teleg_id = recorig.profile.teleg_id;
user.profile.saw_zoom_presentation = recorig.profile.saw_zoom_presentation;
// user.profile.saw_zoom_presentation = recorig.profile.saw_zoom_presentation;
user.profile.saw_and_accepted = recorig.profile.saw_and_accepted;
user.profile.my_dream = recorig.profile.my_dream;
// user.profile.my_dream = recorig.profile.my_dream;
user.profile.email_paypal = recorig.profile.email_paypal;
user.profile.payeer_id = recorig.profile.payeer_id;
user.profile.advcash_id = recorig.profile.advcash_id;

View File

@@ -105,23 +105,27 @@ module.exports = {
});
},
sendEmail_Normale: function (to, subject, html, replyTo) {
sendEmail_Normale: async function (to, subject, html, replyTo) {
// setup e-mail data with unicode symbols
var mailOptions = {
from: tools.getEmailByIdApp(mylocalsconf.idapp), // sender address
dataemail: await this.getdataemail(idapp),
to: to,
generateTextFromHTML: true,
subject: subject,
html: html,
};
if (replyTo)
mailOptions['reply-to'] = replyTo;
if (process.env.SEND_EMAIL === 1) {
const smtpTransport = this.getTransport(mylocalsconf);
if (process.env.SEND_EMAIL === "1") {
// console.log("SEND EMAIL...");
// send mail with defined transport object
// send mail with defined transport object
smtpTransport.sendMail(mailOptions, function (error, response) {
if (error) {
console.log("Email Inviata ERRORE RISPOSTA: " + error);
@@ -328,7 +332,8 @@ module.exports = {
if (!!mylocalsconf.dataemail.emailtitle && !!mylocalsconf.dataemail.emailbody) {
const replyto = tools.getreplyToEmailByIdApp(idapp);
return this.sendEmail_base('standard', emailto, mylocalsconf, replyto);
//return this.sendEmail_base('standard', emailto, mylocalsconf, replyto);
return await this.sendEmail_Normale(emailto, mylocalsconf.dataemail.emailtitle, mylocalsconf.dataemail.emailbody, replyto);
}
// Send Email also to the Admin
@@ -490,7 +495,7 @@ module.exports = {
// Create Transport
let smtpTransport = null;
if (mylocalsconf.dataemail.email_service !== 'gmail' && mylocalsconf.dataemail.email_service !== undefined) {
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,
@@ -500,21 +505,24 @@ module.exports = {
}
});
} else if (mylocalsconf.dataemail.email_service === 'gmail' && mylocalsconf.dataemail.email_service !== undefined) {
smtpTransport = {
//smtpTransport = {
smtpTransport = nodemailer.createTransport({
service: 'gmail', //'Gmail',
auth: {
user: mylocalsconf.dataemail.from,
pass: mylocalsconf.dataemail.pwd_from
}
};
});
} else {
smtpTransport = {
// smtpTransport = {
smtpTransport = nodemailer.createTransport({
service: 'gmail',
auth: {
user: tools.getEmailByIdApp(mylocalsconf.idapp),
pass: tools.getPwdByIdApp(mylocalsconf.idapp)
}
};
});
}
return smtpTransport;
@@ -719,6 +727,28 @@ module.exports = {
console.log('-> Invio Email TEST a', mylocalsconf.emailto, 'previewonly', previewonly);
return this.sendEmail_base('newsletter/' + lang, mylocalsconf.emailto, mylocalsconf, '', smtpTransport, previewonly);
},
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>&nbsp;';
/*const htmlToText = require('html-to-text');
messaggio = htmlToText.fromString(messaggio, {
wordwrap: 80,
preserveNewlines: true,
singleNewLineParagraphs: true
});
*/
return await this.sendEmail_ByText(lang, email, myuser, idapp, {
emailbody: messaggio,
emailtitle: mytitle
});
}

View File

@@ -1502,8 +1502,8 @@ class Telegram {
mystr += '\n3. ' + this.getsymb(emo.PENCIL, tools.isBitActive(user.profile.saw_and_accepted, shared_consts.Accepted.CHECK_READ_GUIDELINES)) + tools.get__('LINEE_GUIDA', this.getlang(msg));
mystr += '\n4. ' + this.getsymb(emo.TV, tools.isBitActive(user.profile.saw_and_accepted, shared_consts.Accepted.CHECK_SEE_VIDEO_PRINCIPI)) + tools.get__('VIDEO_INTRO', this.getlang(msg));
mystr += '\n5. ' + this.getsymb(emo.EYES, user.profile.saw_zoom_presentation) + tools.get__('ZOOM_PARTECIPATO', this.getlang(msg));
mystr += '\n6. ' + this.getsymb(emo.DREAM, this.isdreamset(user)) + tools.get__('SCRITTO_SOGNO', this.getlang(msg));
// mystr += '\n5. ' + this.getsymb(emo.EYES, user.profile.saw_zoom_presentation) + tools.get__('ZOOM_PARTECIPATO', this.getlang(msg));
// mystr += '\n6. ' + this.getsymb(emo.DREAM, this.isdreamset(user)) + tools.get__('SCRITTO_SOGNO', this.getlang(msg));
mystr += '\n7. ' + this.getsymb(emo.CREDIT_CARD, this.ispayment(user)) + tools.get__('PAYMENTS', this.getlang(msg));
}
@@ -1772,9 +1772,11 @@ class Telegram {
} else if (qualelink === 'empower') {
return "ITA 🇮🇹: https://t.me/joinchat/C741mkx5QYXu-kyYCYvA8g" + tools.ACAPO +
"SLO 🇸🇮: https://t.me/aynislovenija" + tools.ACAPO +
"HRV 🇭🇷 BIH 🇧🇦 SRB 🇷🇸 MNE 🇲🇪: https://t.me/joinchat/KFGPolcH0lLrqrdloOASYQ" + tools.ACAPO +
"ESP 🇪🇸 - PRT 🇵🇹: https://t.me/joinchat/AL2qKBqJRuIEuc2FivgAzg" + tools.ACAPO +
"ENG 🇬🇧: https://t.me/joinchat/AL2qKBYX0yVvOJ6Ssf9hKg" + tools.ACAPO +
"FRA 🇫🇷: https://t.me/joinchat/POqmM1ddtRmnxtLdKkm5sQ";
"FRA 🇫🇷: https://t.me/joinchat/POqmM1ddtRmnxtLdKkm5sQ" + tools.ACAPO +
"ENG 🇬🇧: https://t.me/joinchat/AL2qKBYX0yVvOJ6Ssf9hKg" + tools.ACAPO
;
}
}
@@ -1796,9 +1798,9 @@ class Telegram {
let mytext = "";
if (this.getlang(msg) === 'it')
mytext = printf(tools.get__('TESTO_ASSISTENZA', this.getlang(msg)), sito, empower, biblio, faq, help);
mytext = printf(tools.get__('TESTO_ASSISTENZA', this.getlang(msg)), sito, biblio, empower, faq, help);
else
mytext = printf(tools.get__('TESTO_ASSISTENZA', this.getlang(msg)), sito, empower, biblio, help);
mytext = printf(tools.get__('TESTO_ASSISTENZA', this.getlang(msg)), sito, biblio, empower, help);
let menu = null;
const rec = this.getRecInMem(msg);