diff --git a/config/config.js b/config/config.js index 3da503db74366867bbf006c3aa83d2bae8ddc0ea..e4bb457ce3bd4b6f30a784e4ec7d2dc685fba4b4 100644 --- a/config/config.js +++ b/config/config.js @@ -28,6 +28,7 @@ module.exports = { host: 'mailhost', // hostname secureConnection: false, // TLS requires secureConnection to be false port: 587, // port for secure SMTP + TLS: true, // sets requireTLS authUser: 'mailuser', authPass: 'mailpass', tlsCiphers: 'SSLv3', @@ -66,6 +67,7 @@ module.exports = { host: 'mailhost', // hostname secureConnection: false, // TLS requires secureConnection to be false port: 587, // port for secure SMTP + TLS: true, // sets requireTLS authUser: 'mailuser', authPass: 'mailpass', tlsCiphers: 'SSLv3', @@ -75,4 +77,4 @@ module.exports = { token_readWriteProjects: 'token-goes-here' } } -} \ No newline at end of file +} diff --git a/config/mailer.js b/config/mailer.js index 34751737eaef8f353a8bc179ea41213ec82c2578..d7c6faf0983428c4e15944cf5d85fa68ee5c158f 100644 --- a/config/mailer.js +++ b/config/mailer.js @@ -1,4 +1,6 @@ -const nodemailer = require('nodemailer') +const nodemailer = require('nodemailer'); +const nodemailerNTLMAuth = require('nodemailer-ntlm-auth'); + var env = process.env.NODE_ENV || 'testing'; const config = require('./config')[env] @@ -7,9 +9,18 @@ var smtpTransport = nodemailer.createTransport({ host: config.mailer.host, secure: config.mailer.secureConnection, port: config.mailer.port, + requireTLS: config.mailer.TLS, auth: { + type: 'custom', + method: 'NTLM', user: config.mailer.authUser, - pass: config.mailer.authPass + pass: config.mailer.authPass, + options: { + domain: 'ad' + } + }, + customAuth:{ + NTLM: nodemailerNTLMAuth } }); @@ -25,4 +36,4 @@ var mailer = { options: mailOptions } -module.exports = mailer \ No newline at end of file +module.exports = mailer diff --git a/package.json b/package.json index 53eff8b266c2514c7fb65eb12bf03cd8109d7976..78d2bb4106093f642e5e0f22d0ce5d86178b5cdf 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "mysql": "^2.17.1", "mysql2": "^2.2.5", "nodemailer": "^6.3.1", + "nodemailer-ntlm-auth": "^1.0.1", "passport": "0.3.2", "passport-saml": "^2.1.0", "pug": "^3.0.2"