Hi,

There's a problem with the service "email validator" that considers "test@test" like a valid email address. But the address is invalid because there no top level domain.

Best Regards

Comments

cilefen’s picture

Title: E-mail validator error » egulias/EmailValidator allows addresses without TLDs
Status: Active » Needs review
Related issues: +#2343043: valid_email_address() should use egulias/EmailValidator and become deprecated

Addresses without dots are allowed, with some exceptions:

A domain name (or often just a "domain") consists of one or more
components, separated by dots if more than one appears. In the case
of a top-level domain used by itself in an email address, a single
string is used without any dots.

http://tools.ietf.org/html/rfc5321#section-2.3.5

cilefen’s picture

The full RFC section should be read by anyone interested in this issue http://tools.ietf.org/html/rfc5321#section-2.3.5.

cilefen’s picture

Status: Needs review » Active
Dane Powell’s picture

andypost’s picture

This still blocks international adoption

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

drakythe’s picture

My team and I discovered this issue today and were digging in. I made a comment over on https://www.drupal.org/node/2997196#comment-13475788

TL;DR: Why can we not specify the validator we want to use for email? The library provides a number of them and it would allow for more use cases without additional modules being implemented.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

longwave’s picture

Issue tags: -email, -validation

This same question came from a client today.

I think this should be considered won't fix, as the RFC explicitly allows this as stated in #2.

https://serverfault.com/questions/721927/can-you-have-an-email-address-w... is the same question.

As an example, the .tt TLD has MX records so example@tt is a perfectly valid email address and we should not stop whoever owns these email addresses from using them in Drupal.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Issue tags: +Bug Smash Initiative

According to #1 and #15, and my own reading of RFC5321 there seems to be nothing to do here.

#12 asks how to specify a custom validator which is suitable for a separate issue, a Support request.

Spokje’s picture

Agreeing with @longwave and @quietone about the fact that there's nothing to do here.

If someone wants to implement a custom validator, the Change Record here: https://www.drupal.org/node/2997196 mentions:

In order to change core's email validation you can swap out the existing email.validator with a service that implements \Drupal\Component\Utility\EmailValidatorInterface. See https://www.drupal.org/docs/8/api/services-and-dependency-injection/alte... for more. To stay compatible with existing Drupal 8 code, it is recommended that the new class extends from \Egulias\EmailValidator\EmailValidator.

quietone’s picture

@Spokje, thank you for answering the question in #12. I completely forgot to look at the change record.

larowlan’s picture

Status: Active » Closed (works as designed)

I concur, so that makes four of us, so going to mark this as works as designed

Thanks everyone

darvanen’s picture

Here's a new-ish module for greater control over email validation:

https://www.drupal.org/project/advanced_email_validation