relay: add option to accept self-signed certs
This commit is contained in:
1
CHANGES
1
CHANGES
@@ -1584,4 +1584,5 @@
|
|||||||
* Preserve update backups for 3 weeks
|
* Preserve update backups for 3 weeks
|
||||||
* Make send test mail functionality work with secondary domain
|
* Make send test mail functionality work with secondary domain
|
||||||
* Add support for an external email relay that does not require authentication
|
* Add support for an external email relay that does not require authentication
|
||||||
|
* Add option to accept self-signed certs when using external mail relay
|
||||||
|
|
||||||
|
|||||||
@@ -180,6 +180,8 @@ function checkSmtpRelay(relay, callback) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (relay.acceptSelfSignedCerts) options.tls = { rejectUnauthorized: false };
|
||||||
|
|
||||||
var transporter = nodemailer.createTransport(smtpTransport(options));
|
var transporter = nodemailer.createTransport(smtpTransport(options));
|
||||||
|
|
||||||
transporter.verify(function(error) {
|
transporter.verify(function(error) {
|
||||||
|
|||||||
@@ -170,6 +170,7 @@ function setMailRelay(req, res, next) {
|
|||||||
if ('port' in req.body && typeof req.body.port !== 'number') return next(new HttpError(400, 'port must be a string'));
|
if ('port' in req.body && typeof req.body.port !== 'number') return next(new HttpError(400, 'port must be a string'));
|
||||||
if ('username' in req.body && typeof req.body.username !== 'string') return next(new HttpError(400, 'username must be a string'));
|
if ('username' in req.body && typeof req.body.username !== 'string') return next(new HttpError(400, 'username must be a string'));
|
||||||
if ('password' in req.body && typeof req.body.password !== 'string') return next(new HttpError(400, 'password must be a string'));
|
if ('password' in req.body && typeof req.body.password !== 'string') return next(new HttpError(400, 'password must be a string'));
|
||||||
|
if ('acceptSelfSignedCerts' in req.body && typeof req.body.acceptSelfSignedCerts !== 'boolean') return next(new HttpError(400, 'acceptSelfSignedCerts must be a boolean'));
|
||||||
|
|
||||||
mail.setMailRelay(req.params.domain, req.body, function (error) {
|
mail.setMailRelay(req.params.domain, req.body, function (error) {
|
||||||
if (error && error.reason === MailError.NOT_FOUND) return next(new HttpError(404, error.message));
|
if (error && error.reason === MailError.NOT_FOUND) return next(new HttpError(404, error.message));
|
||||||
|
|||||||
Reference in New Issue
Block a user