From 070a70650fc848d8e040599df70378035ddb75f9 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Tue, 10 May 2022 19:43:10 -0700 Subject: [PATCH] Added SMTP name, #3955. --- meshcentral-config-schema.json | 11 +++++++++-- meshmail.js | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/meshcentral-config-schema.json b/meshcentral-config-schema.json index 3aa49475..73800a8e 100644 --- a/meshcentral-config-schema.json +++ b/meshcentral-config-schema.json @@ -944,14 +944,21 @@ "description": "Connects MeshCentral to a SMTP email server, allows MeshCentral to send email messages for 2FA or user notification.", "type": "object", "properties": { + "name": { + "type": "string", + "format": "hostname", + "description": "Optional hostname of the client, this defaults to the hostname of the machine. This is useful for SMTP relays." + }, "host": { "type": "string", - "format": "hostname" + "format": "hostname", + "description": "Hostname of the SMTP server." }, "port": { "type": "integer", "minimum": 1, - "maximum": 65535 + "maximum": 65535, + "description": "SMTP server port number." }, "from": { "type": "string", diff --git a/meshmail.js b/meshmail.js index 589d7be5..168b6769 100644 --- a/meshmail.js +++ b/meshmail.js @@ -44,7 +44,7 @@ module.exports.CreateMeshMail = function (parent, domain) { } else if (obj.config.smtp != null) { // Setup SMTP mail server const nodemailer = require('nodemailer'); - var options = { host: obj.config.smtp.host, secure: (obj.config.smtp.tls == true), tls: {} }; + var options = { name: obj.config.smtp.name, host: obj.config.smtp.host, secure: (obj.config.smtp.tls == true), tls: {} }; //var options = { host: obj.config.smtp.host, secure: (obj.config.smtp.tls == true), tls: { secureProtocol: 'SSLv23_method', ciphers: 'RSA+AES:!aNULL:!MD5:!DSS', secureOptions: constants.SSL_OP_NO_SSLv2 | constants.SSL_OP_NO_SSLv3 | constants.SSL_OP_NO_COMPRESSION | constants.SSL_OP_CIPHER_SERVER_PREFERENCE, rejectUnauthorized: false } }; if (obj.config.smtp.port != null) { options.port = obj.config.smtp.port; } if (obj.config.smtp.tlscertcheck === false) { options.tls.rejectUnauthorized = false; }