📧 fix: Correct Handling of Self-Signed Certificates in sendEmail (#2148)
- note: To put it in a different way, if you put rejectUnauthorized: true, it means that self-signed certificates should not be allowed. This means, that EMAIL_ALLOW_SELFSIGNED is set to false
This commit is contained in:
@@ -2,6 +2,7 @@ const fs = require('fs');
|
||||
const path = require('path');
|
||||
const nodemailer = require('nodemailer');
|
||||
const handlebars = require('handlebars');
|
||||
const { isEnabled } = require('~/server/utils');
|
||||
const logger = require('~/config/winston');
|
||||
|
||||
const sendEmail = async (email, subject, payload, template) => {
|
||||
@@ -13,7 +14,7 @@ const sendEmail = async (email, subject, payload, template) => {
|
||||
requireTls: process.env.EMAIL_ENCRYPTION === 'starttls',
|
||||
tls: {
|
||||
// Whether to accept unsigned certificates
|
||||
rejectUnauthorized: process.env.EMAIL_ALLOW_SELFSIGNED === 'true',
|
||||
rejectUnauthorized: !isEnabled(process.env.EMAIL_ALLOW_SELFSIGNED),
|
||||
},
|
||||
auth: {
|
||||
user: process.env.EMAIL_USERNAME,
|
||||
|
||||
Reference in New Issue
Block a user