Skip to content

Commit 8122bc7

Browse files
committed
[SER-647] Whitelabeling add emailing parameters
1 parent 912154e commit 8122bc7

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

extend/mail.example.js

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
11
//file should be placed in countly/extend
22
//edit this script and put it in countly/extend/mail.js to overwrite existing email templates and settings
33
var nodemailer = require('nodemailer');
4-
4+
const pluginManager = require('../plugins/pluginManager.js');
5+
const plugins = pluginManager.getPlugins();
56
//rename company
67
var company = "Company";
78
var email = "[email protected]";
89

10+
if (plugins.indexOf('white-labeling') > -1) {
11+
try {
12+
const pluginsConfig = pluginManager.getConfig("white-labeling");
13+
const {emailFrom, emailCompany} = pluginsConfig;
14+
email = emailFrom && emailFrom.length > 0 ? emailFrom : email;
15+
company = emailCompany && emailCompany.length > 0 ? emailCompany : company;
16+
}
17+
catch (error) {
18+
console.log('Error getting plugins config', error);
19+
}
20+
}
21+
22+
923
module.exports = function(mail) {
1024
//define this if you need to send email from some third party service
1125
mail.smtpTransport = nodemailer.createTransport({

0 commit comments

Comments
 (0)