Skip to content

fix(composer): validate recipients#1310

Merged
andrinoff merged 4 commits into
floatpane:masterfrom
FromSi:fix/composer-email-validation
May 20, 2026
Merged

fix(composer): validate recipients#1310
andrinoff merged 4 commits into
floatpane:masterfrom
FromSi:fix/composer-email-validation

Conversation

@FromSi
Copy link
Copy Markdown
Member

@FromSi FromSi commented May 19, 2026

What?

Added recipient validation in the composer for To, Cc, and Bcc fields.

  • Validate email fields with mail.ParseAddress() when leaving a recipient field.
  • Normalize display-name addresses to plain email addresses after validation.
  • Clear inline validation errors when the user edits the field again.
  • Block sending when recipient fields are invalid or when no recipients are provided.
  • Show a composer notice for send-time validation problems.
  • Added i18n keys for invalid recipient errors.
view

Why?

This prevents confusing SMTP failures caused by invalid recipient input and gives users immediate feedback inside the composer.

Closes #648
Closes #734

Testing

Added composer tests for:

  • email list normalization;
  • inline validation after leaving a recipient field;
  • clearing validation errors when typing again;
  • blocking send when a recipient field is invalid;
  • blocking send when no recipients are provided;
  • contact suggestion insertion behavior.

@FromSi FromSi requested a review from a team as a code owner May 19, 2026 19:14
@floatpanebot floatpanebot added bug Something isn't working area/tui Terminal UI / view layer area/i18n Localization / translations size/L Diff: 201–800 lines labels May 19, 2026
@FromSi
Copy link
Copy Markdown
Member Author

FromSi commented May 19, 2026

@andriy-chernov need help with i18n

Comment thread tui/composer.go
}
fromOverride := ""
if m.isCatchAllAccount() {
fromOverride = m.fromInput.Value()
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@andrinoff Please double-check this FromOverride path for catch-all accounts. This value may not always be in the format expected by SMTP and could cause a syntax error like: 501 5.5.2 Syntax error, expected: MAIL FROM:<reverse-path> [parameters]. Thanks!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

SMTP expects Name <email@something.com>.

for catch-all accounts, you can make a mistake there, yes.

You can add the check for it too, if you want. Just make sure to include that for accounts that do not have a name just@email.com is needed.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Added 89c73b6

@andrinoff
Copy link
Copy Markdown
Member

ill check everything out tomorrow, @mavonx, you too. crisis IRL

@andrinoff andrinoff force-pushed the fix/composer-email-validation branch from f9d23a9 to 11ceed9 Compare May 19, 2026 20:34
@floatpanebot floatpanebot added dependencies Dependency updates ci CI / build pipeline labels May 19, 2026
@andrinoff andrinoff force-pushed the fix/composer-email-validation branch from 11ceed9 to 2292865 Compare May 19, 2026 20:35
@floatpanebot floatpanebot added area/calendar Calendar integration area/daemon Daemon / RPC area/nix Nix flake / packaging labels May 19, 2026
@andrinoff andrinoff force-pushed the fix/composer-email-validation branch from 2292865 to ddd0095 Compare May 19, 2026 20:35
@andrinoff andrinoff removed area/calendar Calendar integration area/daemon Daemon / RPC area/nix Nix flake / packaging dependencies Dependency updates ci CI / build pipeline labels May 19, 2026
@andriy-chernov
Copy link
Copy Markdown
Member

done, @andrinoff move the commit, please

@mavonx
Copy link
Copy Markdown
Contributor

mavonx commented May 19, 2026

ill check everything out tomorrow, @mavonx, you too. crisis IRL

@andrinoff

Hope everything gets better soon.

@FromSi
Copy link
Copy Markdown
Member Author

FromSi commented May 19, 2026

@andriy-chernov Sorry, I just noticed that the invalid_email_fields text was not quite right. It said “recipient”, but it should say “email” because the validation can also apply to the From field.

Signed-off-by: drew <me@andrinoff.com>
Copy link
Copy Markdown
Member

@andrinoff andrinoff left a comment

Choose a reason for hiding this comment

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

lgtm

@andrinoff andrinoff merged commit bd57cd0 into floatpane:master May 20, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/i18n Localization / translations area/tui Terminal UI / view layer bug Something isn't working size/L Diff: 201–800 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: No email address format validation in composer BUG: Composer does not validate email addresses in To/Cc/Bcc

5 participants