mirror of
https://github.com/binwiederhier/ntfy.git
synced 2026-05-09 08:26:00 +02:00
[PR #1681] [MERGED] Add email verification #1689
Labels
No labels
ai-generated
android-app
android-app
android-app
🪲 bug
build
build
dependencies
docs
enhancement
enhancement
🔥 HOT
in-progress 🏃
ios
prio:low
prio:low
pull-request
question
🔒 security
server
server
unified-push
web-app
website
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ntfy#1689
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/binwiederhier/ntfy/pull/1681
Author: @binwiederhier
Created: 3/30/2026
Status: ✅ Merged
Merged: 3/30/2026
Merged by: @binwiederhier
Base:
main← Head:email-verification📝 Commits (10+)
61dd788WIP: Email verification6aebc5cRefine3e634e0Refinebdea8c3Refine docs and bump deps63ec73aTests07b3812Docs, fix generator4c6225eDocse57ef84Fix limits for anon users51da5e0Review6219784Bump📊 Changes
33 files changed (+1221 additions, -209 deletions)
View changed files
📝
cmd/serve.go(+5 -0)📝
docs/config.md(+22 -1)📝
docs/install.md(+38 -38)📝
docs/publish.md(+11 -5)📝
docs/releases.md(+19 -2)📝
docs/static/js/config-generator.js(+6 -0)📝
go.mod(+1 -1)📝
go.sum(+2 -2)➕
mail/sender.go(+154 -0)📝
server/config.go(+2 -0)📝
server/errors.go(+4 -0)📝
server/server.go(+36 -6)📝
server/server.yml(+3 -0)📝
server/server_account.go(+106 -0)📝
server/server_middleware.go(+9 -0)📝
server/server_test.go(+171 -0)📝
server/smtp_sender.go(+7 -16)📝
server/types.go(+11 -0)📝
server/visitor.go(+5 -1)📝
user/manager.go(+50 -0)...and 13 more files
📄 Description
Verified email recipients
Adds email address verification for outgoing email notifications, gated behind a new
smtp-sender-verifyconfig flag (defaultfalse).What it does
When
smtp-sender-verify: true:X-Email: yes(ortrue/1) to send to their first verified addressWhen
smtp-sender-verifyis unset orfalse, email sending works exactly as before — any user can send to any address. The feature is fully backwards compatible.Changes
New
mailpackage (mail/sender.go): SMTP email sending withSendRaw/Sendmethods, in-memory verification code storage with background expiry, andClose()for cleanup.Database: New
user_emailtable (SQLite + PostgreSQL migrations v6→v7) withEmails()/AddEmail()/RemoveEmail()on the user manager.Server: Three new API endpoints (verify, add, delete email),
convertEmailAddress()that enforces verification when the flag is on,ensureEmailsEnabledmiddleware, rate limiting verification emails against the user's email quota.smtpSendernow delegates tomail.Sender.SendRaw()instead of duplicating SMTP auth logic.Web app:
Emailscomponent (mirrors phone numbers),AddEmailDialogwith verification code flow,EmailVerificationCodeInvalidErrorfor specific error handling. Section only visible whenenable_email_verifyis true in the server config.Config:
smtp-sender-verifybool flag with CLI flag, env var (NTFY_SMTP_SENDER_VERIFY), server.yml docs, config generator toggle, and config reference table entry.Tests: User manager tests for email CRUD + duplicate detection (SQLite + PostgreSQL), server tests covering verified address, bool value resolution, anonymous rejection, no-verified-emails, and backwards compatibility.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.