- Send email when new subscriber to the newsletter
This commit is contained in:
@@ -30,7 +30,7 @@ function checkifSendEmail() {
|
||||
|
||||
|
||||
module.exports = {
|
||||
sendEmail_base: function (template, user, to, mylocalsconf, replyTo) {
|
||||
sendEmail_base: function (template, to, mylocalsconf, replyTo) {
|
||||
|
||||
console.log('mylocalsconf', mylocalsconf);
|
||||
|
||||
@@ -135,13 +135,13 @@ module.exports = {
|
||||
emailto: emailto,
|
||||
};
|
||||
|
||||
this.sendEmail_base('registration/' + lang, user, emailto, mylocalsconf, tools.getreplyToEmailByIdApp(idapp));
|
||||
this.sendEmail_base('registration/' + lang, emailto, mylocalsconf, tools.getreplyToEmailByIdApp(idapp));
|
||||
|
||||
// Send to the Admin an Email
|
||||
this.sendEmail_base('admin/registration/' + lang, user, tools.getAdminEmailByIdApp(idapp), mylocalsconf, '');
|
||||
this.sendEmail_base('admin/registration/' + lang, tools.getAdminEmailByIdApp(idapp), mylocalsconf, '');
|
||||
|
||||
if (tools.isManagAndAdminDifferent(idapp)) {
|
||||
this.sendEmail_base('admin/registration/' + lang, user, tools.getManagerEmailByIdApp(idapp), mylocalsconf, '');
|
||||
this.sendEmail_base('admin/registration/' + lang, tools.getManagerEmailByIdApp(idapp), mylocalsconf, '');
|
||||
}
|
||||
},
|
||||
sendEmail_RequestNewPassword: function (lang, emailto, idapp, tokenforgot) {
|
||||
@@ -154,7 +154,7 @@ module.exports = {
|
||||
emailto: emailto,
|
||||
};
|
||||
|
||||
this.sendEmail_base('resetpwd/' + lang, user, emailto, mylocalsconf, '');
|
||||
this.sendEmail_base('resetpwd/' + lang, emailto, mylocalsconf, '');
|
||||
},
|
||||
|
||||
sendEmail_Booking: function (res, lang, emailto, user, idapp, recbooking) {
|
||||
@@ -184,13 +184,13 @@ module.exports = {
|
||||
texthtml = 'makebooking';
|
||||
}
|
||||
|
||||
this.sendEmail_base('booking/'+texthtml+'/' + lang, user, emailto, mylocalsconf, tools.getreplyToEmailByIdApp(idapp));
|
||||
this.sendEmail_base('booking/'+texthtml+'/' + lang, emailto, mylocalsconf, tools.getreplyToEmailByIdApp(idapp));
|
||||
|
||||
// Send Email also to the Admin
|
||||
this.sendEmail_base('admin/'+texthtml+'/' + lang, user, tools.getAdminEmailByIdApp(idapp), mylocalsconf, '');
|
||||
this.sendEmail_base('admin/'+texthtml+'/' + lang, tools.getAdminEmailByIdApp(idapp), mylocalsconf, '');
|
||||
|
||||
if (tools.isManagAndAdminDifferent(idapp)) {
|
||||
this.sendEmail_base('admin/'+texthtml+'/' + lang, user, tools.getManagerEmailByIdApp(idapp), mylocalsconf, '');
|
||||
this.sendEmail_base('admin/'+texthtml+'/' + lang, tools.getManagerEmailByIdApp(idapp), mylocalsconf, '');
|
||||
}
|
||||
|
||||
},
|
||||
@@ -213,13 +213,13 @@ module.exports = {
|
||||
if (recbooking.numpeople > 1)
|
||||
mylocalsconf.participants = recbooking.numpeople.toString() + ' ' + res.__("partecipanti");
|
||||
|
||||
this.sendEmail_base('booking/cancelbooking/' + lang, user, emailto, mylocalsconf, tools.getreplyToEmailByIdApp(idapp));
|
||||
this.sendEmail_base('booking/cancelbooking/' + lang, emailto, mylocalsconf, tools.getreplyToEmailByIdApp(idapp));
|
||||
|
||||
// Send Email also to the Admin
|
||||
this.sendEmail_base('admin/cancelbooking/' + lang, user, tools.getAdminEmailByIdApp(idapp), mylocalsconf, '');
|
||||
this.sendEmail_base('admin/cancelbooking/' + lang, tools.getAdminEmailByIdApp(idapp), mylocalsconf, '');
|
||||
|
||||
if (tools.isManagAndAdminDifferent(idapp)) {
|
||||
this.sendEmail_base('admin/cancelbooking/' + lang, user, tools.getManagerEmailByIdApp(idapp), mylocalsconf, '');
|
||||
this.sendEmail_base('admin/cancelbooking/' + lang, tools.getManagerEmailByIdApp(idapp), mylocalsconf, '');
|
||||
}
|
||||
},
|
||||
|
||||
@@ -240,10 +240,29 @@ module.exports = {
|
||||
strlinkreply: tools.getHostByIdApp(idapp) + '/messages/' + recmsg._id
|
||||
};
|
||||
|
||||
return this.sendEmail_base('msg/sendmsg/' + lang, user, emailto, mylocalsconf, tools.getreplyToEmailByIdApp(idapp));
|
||||
return this.sendEmail_base('msg/sendmsg/' + lang, emailto, mylocalsconf, tools.getreplyToEmailByIdApp(idapp));
|
||||
|
||||
// Send Email also to the Admin
|
||||
// this.sendEmail_base('admin/sendmsg/' + lang, user, tools.getAdminEmailByIdApp(idapp), mylocalsconf);
|
||||
// this.sendEmail_base('admin/sendmsg/' + lang, tools.getAdminEmailByIdApp(idapp), mylocalsconf);
|
||||
},
|
||||
sendEmail_Newsletter: function (lang, user, idapp) {
|
||||
|
||||
console.log('idapp', idapp, tools.getNomeAppByIdApp(idapp));
|
||||
|
||||
mylocalsconf = {
|
||||
locale: lang,
|
||||
nomeapp: tools.getNomeAppByIdApp(idapp),
|
||||
name: user.name,
|
||||
surname: user.surname,
|
||||
emailto: user.email,
|
||||
};
|
||||
|
||||
// Send to the Admin an Email
|
||||
this.sendEmail_base('admin/added_to_newsletter/' + lang, tools.getAdminEmailByIdApp(idapp), mylocalsconf, '');
|
||||
|
||||
if (tools.isManagAndAdminDifferent(idapp)) {
|
||||
this.sendEmail_base('admin/added_to_newsletter/' + lang, tools.getManagerEmailByIdApp(idapp), mylocalsconf, '');
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user