Skip to content

[CS-1425] Validate email format using URI::MailTo::EMAIL_REGEXP - #40

Merged
draganfabijan merged 2 commits into
mainfrom
DEV-1425-1
Jan 27, 2026
Merged

draganfabijan merged 2 commits into
mainfrom
DEV-1425-1

Conversation

@draganfabijan

@draganfabijan draganfabijan commented Jan 27, 2026 •

Copy link
Copy Markdown
Contributor

Add URI::MailTo::EMAIL_REGEXP validation to the exceptional? method to catch invalid email formats early, preventing Mail::Address from mangling emails with unquoted comments or spaces in the local part.

  • Emails like 'John (comment)@example.com' are now marked exceptional
  • Properly quoted display names like 'John Doe <John @example.com>' still work
  • Database no longer receives corrupted email addresses

Ticket: https://nex-level.atlassian.net/browse/CS-1425

The issue:

Screenshot 2026-01-24 at 12 44 01 AM

Add URI::MailTo::EMAIL_REGEXP validation to the exceptional? method to
catch invalid email formats early, preventing Mail::Address from mangling
emails with unquoted comments or spaces in the local part.

Uses mail_address.address for the regex check (not to_s) to support
subclasses like DisplayNameEmailAddress that format to_s differently.

- Emails like 'john(comment)@example.com' are now marked exceptional
- Properly quoted display names like 'John Doe <john@example.com>' still work
- Database no longer receives corrupted email addresses

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@draganfabijan
draganfabijan requested review from a team, richardchou-nexl and wethu January 27, 2026 00:40
@draganfabijan
draganfabijan merged commit 36ddc84 into main Jan 27, 2026
9 checks passed
@draganfabijan
draganfabijan deleted the DEV-1425-1 branch January 27, 2026 00:50

@grantspeelman grantspeelman 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.

Great Work 👍🏽

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants