Skip to content

Conversation

@USERSATOSHI
Copy link
Contributor

@USERSATOSHI USERSATOSHI commented Jul 14, 2025

What?

Closes #38105

This PR replaces and continues the work from #38758, which appears to have become stale.

Thank you @ediamin for creating the initial PR with great start and this PR hopes to continue of that effort and addresses the edge cases mentioned in discussions.

Why?

WordPress is_email validates emails that are in format of email@<ip-address> while @wordpress/url's isEmail returns false for the same.

This PR adds supports for that.

How?

This PR adds support for this by creating IP_PATTERN which validates ip address and and extends EMAIL_REGEX to use that.

Testing Instructions

Unit test's include email with ip addresses and they should suffice

Screenshots or screencast

image

@github-actions
Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @rjchow.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Unlinked contributors: rjchow.

Co-authored-by: USERSATOSHI <tusharbharti@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@t-hamano t-hamano added [Type] Bug An existing feature does not function as intended [Package] Url /packages/url labels Jul 14, 2025
@USERSATOSHI USERSATOSHI marked this pull request as draft July 14, 2025 10:29
- Remove support for short domains (e.g., `@example`, `@123456789`)
- Remove IPv6 address support in email domains starting without `IPv6:`
- Require domains to have at least two labels separated by dots
- Clean up unused IPv6-related constants and functions
@USERSATOSHI USERSATOSHI force-pushed the fix/isEmail-not-working-for-ip branch from b5e8f0e to 5ddf611 Compare July 23, 2025 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Url /packages/url [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@wordpress/url isEmail fails a email that is considered valid by PHP Wordpress is_email

2 participants