[PR #5891] fix: allow empty MAILER_SMTP_USER and MAILER_SMTP_PASSWORD for unauthenticated SMTP #5398

Open
opened 2026-03-17 02:50:57 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/5891
Author: @danielalanbates
Created: 2/20/2026
Status: 🔄 Open

Base: mainHead: fix/issue-4586


📝 Commits (1)

  • 6b3b49c fix: allow empty MAILER_SMTP_USER and MAILER_SMTP_PASSWORD for unauthenticated SMTP

📊 Changes

3 files changed (+19 additions, -18 deletions)

View changed files

📝 packages/hoppscotch-backend/src/infra-config/helper.ts (+0 -2)
📝 packages/hoppscotch-backend/src/infra-config/infra-config.service.ts (+5 -4)
📝 packages/hoppscotch-backend/src/mailer/helper.ts (+14 -12)

📄 Description

Summary

Fixes #4586

SMTP servers on internal networks often don't require authentication. When MAILER_USE_CUSTOM_CONFIGS=true, setting MAILER_SMTP_USER= and MAILER_SMTP_PASSWORD= to empty strings causes hoppscotch to reject the configuration as invalid and fail to start with auth/provider_not_configured_correctly.

This PR makes MAILER_SMTP_USER and MAILER_SMTP_PASSWORD optional so that unauthenticated SMTP configurations are accepted.

Changes

  • packages/hoppscotch-backend/src/infra-config/helper.ts: Removed MAILER_SMTP_USER and MAILER_SMTP_PASSWORD from the required auth provider configuration keys, since they are not needed for unauthenticated SMTP.
  • packages/hoppscotch-backend/src/infra-config/infra-config.service.ts:
    • Removed MAILER_SMTP_USER and MAILER_SMTP_PASSWORD from the isServiceConfigured() truthiness check, so empty values no longer cause the EMAIL provider to be considered unconfigured.
    • Added a dedicated case for MAILER_SMTP_USER and MAILER_SMTP_PASSWORD in validateEnvValues() that allows empty strings (previously they fell through to a case that rejected empty values).
  • packages/hoppscotch-backend/src/mailer/helper.ts: Only includes the auth object in the nodemailer transport options when a user or password is actually provided. When both are empty, the auth property is omitted entirely, which tells nodemailer to connect without authentication.

Test plan

  • Set .env with MAILER_USE_CUSTOM_CONFIGS=true, MAILER_SMTP_USER=, MAILER_SMTP_PASSWORD= and verify the app starts without error
  • Verify sending email still works with an unauthenticated SMTP server (e.g. local maildev or internal relay)
  • Verify sending email still works with an authenticated SMTP server (non-empty user/password)
  • Verify the onboarding SMTP setup flow accepts empty user/password fields

This PR was created with the assistance of Claude Opus 4.6 by Anthropic. Happy to make any adjustments! Reviewed and submitted by a human.


Summary by cubic

Accept empty MAILER_SMTP_USER and MAILER_SMTP_PASSWORD to support unauthenticated SMTP when MAILER_USE_CUSTOM_CONFIGS=true. This prevents startup failures and lets nodemailer connect without auth when both are empty.

  • Bug Fixes
    • Removed MAILER_SMTP_USER/PASSWORD from required keys and isServiceConfigured checks.
    • Allowed empty strings for these env values in validateEnvValues.
    • Only include auth in SMTP transport when a user or password is provided.

Written for commit 6b3b49c850. Summary will update on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hoppscotch/hoppscotch/pull/5891 **Author:** [@danielalanbates](https://github.com/danielalanbates) **Created:** 2/20/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/issue-4586` --- ### 📝 Commits (1) - [`6b3b49c`](https://github.com/hoppscotch/hoppscotch/commit/6b3b49c850c113efd8018e290479a017478b4eaf) fix: allow empty MAILER_SMTP_USER and MAILER_SMTP_PASSWORD for unauthenticated SMTP ### 📊 Changes **3 files changed** (+19 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `packages/hoppscotch-backend/src/infra-config/helper.ts` (+0 -2) 📝 `packages/hoppscotch-backend/src/infra-config/infra-config.service.ts` (+5 -4) 📝 `packages/hoppscotch-backend/src/mailer/helper.ts` (+14 -12) </details> ### 📄 Description ## Summary Fixes #4586 SMTP servers on internal networks often don't require authentication. When `MAILER_USE_CUSTOM_CONFIGS=true`, setting `MAILER_SMTP_USER=` and `MAILER_SMTP_PASSWORD=` to empty strings causes hoppscotch to reject the configuration as invalid and fail to start with `auth/provider_not_configured_correctly`. This PR makes `MAILER_SMTP_USER` and `MAILER_SMTP_PASSWORD` optional so that unauthenticated SMTP configurations are accepted. ## Changes - **`packages/hoppscotch-backend/src/infra-config/helper.ts`**: Removed `MAILER_SMTP_USER` and `MAILER_SMTP_PASSWORD` from the required auth provider configuration keys, since they are not needed for unauthenticated SMTP. - **`packages/hoppscotch-backend/src/infra-config/infra-config.service.ts`**: - Removed `MAILER_SMTP_USER` and `MAILER_SMTP_PASSWORD` from the `isServiceConfigured()` truthiness check, so empty values no longer cause the EMAIL provider to be considered unconfigured. - Added a dedicated case for `MAILER_SMTP_USER` and `MAILER_SMTP_PASSWORD` in `validateEnvValues()` that allows empty strings (previously they fell through to a case that rejected empty values). - **`packages/hoppscotch-backend/src/mailer/helper.ts`**: Only includes the `auth` object in the nodemailer transport options when a user or password is actually provided. When both are empty, the `auth` property is omitted entirely, which tells nodemailer to connect without authentication. ## Test plan - [ ] Set `.env` with `MAILER_USE_CUSTOM_CONFIGS=true`, `MAILER_SMTP_USER=`, `MAILER_SMTP_PASSWORD=` and verify the app starts without error - [ ] Verify sending email still works with an unauthenticated SMTP server (e.g. local maildev or internal relay) - [ ] Verify sending email still works with an authenticated SMTP server (non-empty user/password) - [ ] Verify the onboarding SMTP setup flow accepts empty user/password fields *This PR was created with the assistance of Claude Opus 4.6 by Anthropic. Happy to make any adjustments! Reviewed and submitted by a human.* <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Accept empty MAILER_SMTP_USER and MAILER_SMTP_PASSWORD to support unauthenticated SMTP when MAILER_USE_CUSTOM_CONFIGS=true. This prevents startup failures and lets nodemailer connect without auth when both are empty. - **Bug Fixes** - Removed MAILER_SMTP_USER/PASSWORD from required keys and isServiceConfigured checks. - Allowed empty strings for these env values in validateEnvValues. - Only include auth in SMTP transport when a user or password is provided. <sup>Written for commit 6b3b49c850c113efd8018e290479a017478b4eaf. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#5398
No description provided.