Skip to content

Commit

Permalink
📧 fix: Correct Handling of Self-Signed Certificates in sendEmail (d…
Browse files Browse the repository at this point in the history
…anny-avila#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
  • Loading branch information
danny-avila authored Mar 20, 2024
1 parent 13d0b70 commit acc39e6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion server/utils/sendEmail.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -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,
Expand Down

0 comments on commit acc39e6

Please sign in to comment.