Skip to content

feat(notifications): allow SMTP without authentication#4844

Open
hbilal9 wants to merge 1 commit into
Dokploy:canaryfrom
hbilal9:feat/smtp-optional-auth
Open

feat(notifications): allow SMTP without authentication#4844
hbilal9 wants to merge 1 commit into
Dokploy:canaryfrom
hbilal9:feat/smtp-optional-auth

Conversation

@hbilal9

@hbilal9 hbilal9 commented Jul 18, 2026

Copy link
Copy Markdown

Summary

Closes #4842

Some SMTP relays — e.g. Google SMTP Relay configured with IP allowlisting — do not use username/password authentication. Dokploy currently force-requires both fields when configuring an email notification, which makes those relays unusable.

This PR makes SMTP credentials optional:

  • handle-notifications.tsx: username and password are now optional in the email form schema, with a hint that they can be left blank when the server doesn't require authentication. Empty values are sent as "" so no DB migration is needed (columns stay NOT NULL).
  • packages/server/src/db/schema/notification.ts: dropped .min(1) from username/password in apiCreateEmail (inherited by apiUpdateEmail and apiTestEmailConnection).
  • packages/server/src/utils/notifications/utils.ts: sendEmailNotification only passes auth to nodemailer.createTransport when both credentials are non-empty; nodemailer treats a missing auth key as unauthenticated SMTP. This covers both real notifications and the Test Connection button, which routes through the same function.

Behavior

  • Credentials provided → identical behavior to today (authenticated SMTP).
  • Both fields left blank → transporter is created without auth, so unauthenticated relays work.

Testing

  • pnpm --filter=@dokploy/server typecheck and pnpm --filter=dokploy typecheck pass.
  • biome check clean on the touched files (one pre-existing formatting drift elsewhere in handle-notifications.tsx left untouched).

Some SMTP relays (e.g. Google SMTP Relay with IP allowlisting) do not
use username/password authentication. Make both fields optional in the
email notification form and API schema, and only pass auth to
nodemailer when credentials are provided.

Closes Dokploy#4842
@hbilal9
hbilal9 requested a review from Siumauricio as a code owner July 18, 2026 06:49
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. enhancement New feature or request labels Jul 18, 2026
AminDhouib added a commit to DevinoSolutions/dokploy-community that referenced this pull request Jul 18, 2026
Drop NOT NULL on the email table's username/password columns so the
"SMTP without authentication" feature can persist genuinely empty
credentials, and add migration 0192 (idempotent ALTER ... DROP NOT NULL,
additive-relaxing) in the next free journal slot after 0191.

Upstream Dokploy#4844 kept the columns NOT NULL and coerced the form to "";
this fork makes the schema match the relaxed intent so credential-less
SMTP relays are represented as NULL rather than empty strings. Loading an
existing email notification coerces the now-nullable username/password to
undefined for the form.
AminDhouib added a commit to DevinoSolutions/dokploy-community that referenced this pull request Jul 18, 2026
port: feat(notifications): allow SMTP without authentication (upstream Dokploy#4844)
@hbilal9

hbilal9 commented Jul 20, 2026

Copy link
Copy Markdown
Author

Hi @Siumauricio, gentle bump on this one when you have a moment. It closes #4842 (unauthenticated SMTP relays like Google SMTP Relay). The change is small — username/password are made optional and auth is only passed to nodemailer when credentials are provided, so existing authenticated setups are unaffected and no DB migration is needed. Since this is my first PR here, the CI checks are waiting on a workflow-run approval — happy to make any changes you'd like. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow empty username and password for SMTP

1 participant