Sendmail fixes.

Ylian Saint-Hilaire committed Nov 27, 2021 at 11:37 UTC 3ae1b139c5a01cb992ef4983ec9aefada5230e99
1 file changed +8 -3
meshcentral.js
+8 -3
@@ -1610,7 +1610,7 @@ function CreateMeshCentralServer(config, args) {
1610 // Sendmail server
1611 obj.mailserver = require('./meshmail.js').CreateMeshMail(obj);
1612 obj.mailserver.verify();
1613 - if (obj.args.lanonly == true) { addServerWarning("Sendmail has limited use in LAN mode.", 18); }
1613 + if (obj.args.lanonly == true) { addServerWarning("SMTP server has limited use in LAN mode.", 18); }
1614 }
1615
1616 // Setup the email server for each domain
@@ -1625,6 +1625,11 @@ function CreateMeshCentralServer(config, args) {
1625 obj.config.domains[i].mailserver = require('./meshmail.js').CreateMeshMail(obj, obj.config.domains[i]);
1626 obj.config.domains[i].mailserver.verify();
1627 if (obj.args.lanonly == true) { addServerWarning("SMTP server has limited use in LAN mode.", 18); }
1628 + } else if (obj.config.domains[i].sendmail != null) {
1629 + // Sendmail server
1630 + obj.config.domains[i].mailserver = require('./meshmail.js').CreateMeshMail(obj, obj.config.domains[i]);
1631 + obj.config.domains[i].mailserver.verify();
1632 + if (obj.args.lanonly == true) { addServerWarning("SMTP server has limited use in LAN mode.", 18); }
1633 } else {
1634 // Setup the parent mail server for this domain
1635 if (obj.mailserver != null) { obj.config.domains[i].mailserver = obj.mailserver; }
@@ -3349,7 +3354,7 @@ function mainStart() {
3354 if (domainCount == 0) { allsspi = false; }
3355 for (var i in config.domains) {
3356 if (i.startsWith('_')) continue;
3352 - if (config.domains[i].smtp != null) { nodemailer = true; }
3357 + if ((config.domains[i].smtp != null) || (config.domains[i].sendmail != null)) { nodemailer = true; }
3358 if (config.domains[i].sendgrid != null) { sendgrid = true; }
3359 if (config.domains[i].yubikey != null) { yubikey = true; }
3360 if (config.domains[i].auth == 'ldap') { ldap = true; }
@@ -3387,7 +3392,7 @@ function mainStart() {
3392 if (config.settings.plugins != null) { modules.push('semver'); } // Required for version compat testing and update checks
3393 if ((config.settings.plugins != null) && (config.settings.plugins.proxy != null)) { modules.push('https-proxy-agent'); } // Required for HTTP/HTTPS proxy support
3394 else if (config.settings.xmongodb != null) { modules.push('mongojs'); } // Add MongoJS, old driver.
3390 - if (nodemailer || (config.smtp != null)) { modules.push('nodemailer'); } // Add SMTP support
3395 + if (nodemailer || (config.smtp != null) || (config.sendmail != null)) { modules.push('nodemailer'); } // Add SMTP support
3396 if (sendgrid || (config.sendgrid != null)) { modules.push('@sendgrid/mail'); } // Add SendGrid support
3397 if (args.translate) { modules.push('jsdom'); modules.push('esprima'); modules.push('minify-js'); modules.push('html-minifier'); } // Translation support
3398