From 77bedc1460a4b10750058fdadb1e0952e8d1c95e Mon Sep 17 00:00:00 2001 From: Antonio Mika Date: Mon, 30 Sep 2024 17:33:53 -0400 Subject: [PATCH] Don't send auth when both user and pass are empty --- .devcontainer/docker-compose.yml | 2 +- src/utils/mail.ts | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index e5f302f1..9934fb00 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -24,7 +24,7 @@ services: volumes: - .:/workspaces:cached environment: - NEXTAUTH_URL: "http://10.0.0.217:3000" # Update this to the URL of your dev environment + NEXTAUTH_URL: "${NEXTAUTH_URL:-http://10.0.0.217:3000}" networks: - app-network depends_on: diff --git a/src/utils/mail.ts b/src/utils/mail.ts index 0a0f560e..3289986c 100644 --- a/src/utils/mail.ts +++ b/src/utils/mail.ts @@ -277,10 +277,13 @@ export async function createTransporter() { host: globalOptions.smtpHost, port: globalOptions.smtpPort, secure: globalOptions.smtpUseSSL, - auth: { - user: globalOptions.smtpUsername, - pass: globalOptions.smtpPassword, - }, + auth: + globalOptions.smtpUsername || globalOptions.smtpPassword + ? { + user: globalOptions.smtpUsername, + pass: globalOptions.smtpPassword, + } + : undefined, tls: { rejectUnauthorized: true, minVersion: "TLSv1.2",