Added SMTP name, #3955.

This commit is contained in:
Ylian Saint-Hilaire 2022-05-10 19:43:10 -07:00
parent 14050dd6b7
commit 070a70650f
2 changed files with 10 additions and 3 deletions

View File

@ -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",

View File

@ -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; }