mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 00:40:14 +01:00
📧 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:
parent
f7761df52c
commit
e4ac58012f
1 changed files with 2 additions and 1 deletions
|
|
@ -2,6 +2,7 @@ const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const nodemailer = require('nodemailer');
|
const nodemailer = require('nodemailer');
|
||||||
const handlebars = require('handlebars');
|
const handlebars = require('handlebars');
|
||||||
|
const { isEnabled } = require('~/server/utils');
|
||||||
const logger = require('~/config/winston');
|
const logger = require('~/config/winston');
|
||||||
|
|
||||||
const sendEmail = async (email, subject, payload, template) => {
|
const sendEmail = async (email, subject, payload, template) => {
|
||||||
|
|
@ -13,7 +14,7 @@ const sendEmail = async (email, subject, payload, template) => {
|
||||||
requireTls: process.env.EMAIL_ENCRYPTION === 'starttls',
|
requireTls: process.env.EMAIL_ENCRYPTION === 'starttls',
|
||||||
tls: {
|
tls: {
|
||||||
// Whether to accept unsigned certificates
|
// Whether to accept unsigned certificates
|
||||||
rejectUnauthorized: process.env.EMAIL_ALLOW_SELFSIGNED === 'true',
|
rejectUnauthorized: !isEnabled(process.env.EMAIL_ALLOW_SELFSIGNED),
|
||||||
},
|
},
|
||||||
auth: {
|
auth: {
|
||||||
user: process.env.EMAIL_USERNAME,
|
user: process.env.EMAIL_USERNAME,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue