Skip to content

Fix saving email notification settings with an empty From address - #3408

Merged
Marijn0 merged 1 commit into
motioneye-project:devfrom
Marijn0:fix/email-from-optional
Aug 28, 2026
Merged

Fix saving email notification settings with an empty From address#3408
Marijn0 merged 1 commit into
motioneye-project:devfrom
Marijn0:fix/email-from-optional

Conversation

@Marijn0

@Marijn0 Marijn0 commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

The backend input_sanity_check() throws a error:

raise ValueError(
ERROR: Value "" for setting "email_notifications_from" did not match regex "^[A-Za-z0-9 _+.@^~<>,-]+$": Email addresses are only allowed to contain alphanumerical characters, underscore _, plus +, dot ., at @, caret ^, tilde ~, angle brackets <>, hyphen -, and may be separated by comma, and space

when the From address field in the email notification settings is empty, preventing the settings from being saved. The sanity-check regex requires at least one character. The frontend does not require this field to be set. The UI help mark says:

msgstr "set a custom From address, if your SMTP service requires one (the first destination email address will be used if left blank)."
We now skip the sanity check when email_notifications_from is empty. I guess we could also edit the regex itself if preferred, but it is shared across multiple input fields.

The backend input_sanity_check() throws a ValueError when the From address field in the email notification settings is empty, preventing the settings from being saved. The sanity-check regex requires at least one character. The frontend does not require this field to be set. The UI help mark says: “the first destination email address will be used if left blank.” We now skip the sanity check for an empty value. I guess we could also edit the regex itself if preferred, but it is shared across multiple input fields.
@Marijn0 Marijn0 added this to the v0.45.0 milestone Aug 18, 2026
@Marijn0
Marijn0 requested review from MichaIng and zagrim August 18, 2026 18:36
@Marijn0 Marijn0 self-assigned this Aug 18, 2026
@Marijn0 Marijn0 added the bug label Aug 18, 2026
@Marijn0
Marijn0 requested a lite review from Copilot August 28, 2026 09:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request fixes an inconsistency between the UI and backend validation by allowing the email notification From field (email_notifications_from) to be empty without failing backend input sanity checks, so settings can be saved when the UI leaves it blank.

Changes:

  • Skip input_sanity_check() for email_notifications_from when the UI value is an empty string.
  • Reuse a computed email_from value when formatting the sendmail command line for the on_event_start hook.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@Marijn0
Marijn0 merged commit 91e79cc into motioneye-project:dev Aug 28, 2026
27 of 28 checks passed
@Marijn0
Marijn0 deleted the fix/email-from-optional branch August 28, 2026 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants