Implement remaining email config
This commit is contained in:
1 parent
1794429cbe
commit
de3d38d891
8 files changed
+64
-18
No files matched your search
@@ -74,6 +74,12 @@ class SettingsController {
|
||||
systemEmailPassword,
|
||||
systemEmailUser,
|
||||
systemEmailConnectionHost,
|
||||
systemEmailSecure,
|
||||
systemEmailPool,
|
||||
systemEmailIgnoreTLS,
|
||||
systemEmailRequireTLS,
|
||||
systemEmailRejectUnauthorized,
|
||||
systemEmailTLSServername,
|
||||
} = req.body;
|
||||
|
||||
const subject = this.stringService.testEmailSubject;
|
||||
@@ -91,6 +97,12 @@ class SettingsController {
|
||||
systemEmailAddress,
|
||||
systemEmailPassword,
|
||||
systemEmailConnectionHost,
|
||||
systemEmailSecure,
|
||||
systemEmailPool,
|
||||
systemEmailIgnoreTLS,
|
||||
systemEmailRequireTLS,
|
||||
systemEmailRejectUnauthorized,
|
||||
systemEmailTLSServername,
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -101,6 +101,8 @@ class EmailService {
|
||||
const {
|
||||
systemEmailHost,
|
||||
systemEmailPort,
|
||||
systemEmailSecure,
|
||||
systemEmailPool,
|
||||
systemEmailUser,
|
||||
systemEmailAddress,
|
||||
systemEmailPassword,
|
||||
@@ -111,32 +113,23 @@ class EmailService {
|
||||
systemEmailRejectUnauthorized,
|
||||
} = config;
|
||||
|
||||
const baseEmailConfig = {
|
||||
const emailConfig = {
|
||||
host: systemEmailHost,
|
||||
port: Number(systemEmailPort),
|
||||
secure: true,
|
||||
secure: systemEmailSecure,
|
||||
auth: {
|
||||
user: systemEmailUser || systemEmailAddress,
|
||||
pass: systemEmailPassword,
|
||||
},
|
||||
connectionTimeout: 5000,
|
||||
pool: systemEmailPool,
|
||||
tls: { rejectUnauthorized: systemEmailRejectUnauthorized },
|
||||
ignoreTLS: systemEmailIgnoreTLS,
|
||||
requireTLS: systemEmailRequireTLS,
|
||||
servername: systemEmailTLSServername,
|
||||
name: systemEmailConnectionHost || "localhost",
|
||||
};
|
||||
|
||||
const isSmtps = Number(systemEmailPort) === 465;
|
||||
|
||||
const emailConfig = !isSmtps
|
||||
? {
|
||||
...baseEmailConfig,
|
||||
name: systemEmailConnectionHost || "localhost",
|
||||
secure: false,
|
||||
pool: true,
|
||||
tls: { rejectUnauthorized: systemEmailRejectUnauthorized },
|
||||
ignoreTLS: systemEmailIgnoreTLS,
|
||||
requireTLS: systemEmailRequireTLS,
|
||||
servername: systemEmailTLSServername,
|
||||
}
|
||||
: baseEmailConfig;
|
||||
|
||||
this.transporter = this.nodemailer.createTransport(emailConfig);
|
||||
|
||||
const buildHtml = async (template, context) => {
|
||||
|
||||
@@ -617,10 +617,16 @@ const sendTestEmailBodyValidation = joi.object({
|
||||
to: joi.string().required(),
|
||||
systemEmailHost: joi.string(),
|
||||
systemEmailPort: joi.number(),
|
||||
systemEmailSecure: joi.boolean(),
|
||||
systemEmailPool: joi.boolean(),
|
||||
systemEmailAddress: joi.string(),
|
||||
systemEmailPassword: joi.string(),
|
||||
systemEmailUser: joi.string(),
|
||||
systemEmailConnectionHost: joi.string(),
|
||||
systemEmailIgnoreTLS: joi.boolean(),
|
||||
systemEmailRequireTLS: joi.boolean(),
|
||||
systemEmailRejectUnauthorized: joi.boolean(),
|
||||
systemEmailTLSServername: joi.string(),
|
||||
});
|
||||
|
||||
export {
|
||||
|
||||
Reference in new issue
Block a user