Skip to content

Validator.email may need some rework - Or a new universal email validator is required #17296

Closed

Description

@un33k

I'm submitting a ...

[ x ] feature request

Current behavior
Create a new email validator that validates the FQDN (in a routable sense) as well

Expected behavior
An email validator that finds root@localhost invalid, page@google invalid, but validates [email protected]

Minimal reproduction of the problem with instructions
Create a minimal form and add Validator.email as a synchronous validator.

What is the motivation/use case for changing the behavior?
While root@localhost is a valid email address, 99% of the usage cases "may" require the FQDN in the email to be validated.

Please tell us about your environment:
ng: 4.2.0-rc.2
@angular/cli: 1.1.0-rc.0
node: 6.9.5
os: darwin x64
browser: chrome

Note:
My hope is that this request is not just close with a few links to other issues raised against the current email validator. True; root@localhost is valid. No question about it.

However, the current email validator is 99% unusable to accommodate the 1% need for emails such as root@localhost. Send an email to page@google and see if Larry is going to get it.

Address not found
Your message wasn't delivered to page@google because the domain google couldn't be found. Check for typos or unnecessary spaces and try again.

The problem is that the 1% need is checked first in the current validator and therefore it will make the form valid and submittable, even though the probability of the email being invalid is 99%.

So statistically speaking, we (perhaps) need another validator that sees page@google invalid and won't allow our users send an email where the recipient is not found.

Once again, this is a feature request for a new email validator so developers have a choice. Where developers can use the existing Validators.email or perhaps simply use the new, let's say "Validators.routableEmail"!

Thx.

Activity

  1. tytskyi commented on Jun 7, 2017

    @tytskyi

    Would you be happy if we have validator that does what you described, but goes as a separate package in npm?

  2. un33k commented on Jun 7, 2017

    @un33k
    Author

    @tytskyi I already use my own version within my own code space. So no immediate need. But for the sake of DRY and not copying the same code into all future projects, it would be great to have it come from a single package. Something like @angular/contrib should be good. Contributed by others, blessed by @angular team.

  3. tytskyi commented on Jun 9, 2017

    @tytskyi

    @angular/contrib could be cool. Generally i would like to not have angular core extended - more features means more bugs and more maintenance. This potentially would postpone releases of the core.

  4. un33k commented on Jun 19, 2017

    @un33k
    Author

    @tytskyi not really, neither @angular/material nor @angular/flex-layout have any direct postponement power over @angular/core. @angular/contrib should not have any either. It was just an idea as many packages &| frameworks also have the contrib portion.

  5. tytskyi commented on Jun 19, 2017

    @tytskyi

    @un33k i meant it will add overhead if implemented under @angular/form directly. I am both hands for @angular/contrib

  6. BioPhoton commented on Aug 9, 2017

    @BioPhoton
    Contributor

    This sounds amazing!!

  7. added
    feature
    on Dec 19, 2017
  8. added this to the Backlog milestone on Jan 23, 2018
  9. scottseeker commented on Jan 7, 2019

    @scottseeker

    The local part of the e-mail validation is not coded to the RFC. For instance, \ and " characters immediately cause the validator to fail.

  10. xaviergxf commented on Nov 1, 2019

    @xaviergxf

    Any news about changing the current behavior?

  11. trotyl commented on Nov 1, 2019

    @trotyl
    Contributor

    Any news about changing the current behavior?

    @xaviergxf The current behavior is expected, see #32961.

    Most importantly,

    If this pattern does not satisfy your business needs, you can use Validators.pattern() to validate the value against a different pattern.

  12. angular-robot commented on Jun 4, 2021

    @angular-robot
    Contributor

    Just a heads up that we kicked off a community voting process for your feature request. There are 20 days until the voting process ends.

    Find more details about Angular's feature request process in our documentation.

  13. angular-robot commented on Jun 24, 2021

    @angular-robot
    Contributor

    Thank you for submitting your feature request! Looks like during the polling process it didn't collect a sufficient number of votes to move to the next stage.

    We want to keep Angular rich and ergonomic and at the same time be mindful about its scope and learning journey. If you think your request could live outside Angular's scope, we'd encourage you to collaborate with the community on publishing it as an open source package.

    You can find more details about the feature request process in our documentation.

  14. angular-automatic-lock-bot commented on Jul 26, 2021

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  15. locked and limited conversation to collaborators on Jul 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: formsfeature

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions