Add email verification#1681
Merged
Merged
Conversation
alexlebens
pushed a commit
to alexlebens/infrastructure
that referenced
this pull request
Mar 31, 2026
This PR contains the following updates: | Package | Update | Change | |---|---|---| | [binwiederhier/ntfy](https://github.com/binwiederhier/ntfy) | minor | `2.20.1` → `2.21.0` | | [binwiederhier/ntfy](https://ntfy.sh/) ([source](https://github.com/binwiederhier/ntfy)) | minor | `v2.20.1` → `v2.21.0` | --- ### Release Notes <details> <summary>binwiederhier/ntfy (binwiederhier/ntfy)</summary> ### [`v2.21.0`](https://github.com/binwiederhier/ntfy/releases/tag/v2.21.0) [Compare Source](binwiederhier/ntfy@v2.20.1...v2.21.0) This release adds the ability to verify email addresses using the `smtp-sender-verify` flag. This is a change that is required because ntfy.sh was used to send unsolicited emails and the AWS SES account was suspended. Going forward, ntfy.sh won't be able to send emails unless the email address was verified ahead of time. **Features:** - Add verified email recipients feature with `smtp-sender-verify` config flag, allowing server admins to require email address verification before sending email notifications ([#​1681](binwiederhier/ntfy#1681)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xMDEuMSIsInVwZGF0ZWRJblZlciI6IjQzLjEwMS4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkb2NrZXIiXX0=--> Reviewed-on: https://gitea.alexlebens.dev/alexlebens/infrastructure/pulls/5300 Co-authored-by: Renovate Bot <renovate-bot@alexlebens.net> Co-committed-by: Renovate Bot <renovate-bot@alexlebens.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.