Enhancement for email validation to allow authorized characters from the RFC 5322

Hi,
I was wondering if we could change the way the email address is validated by the function evalEmail()

I usually create aliases to my email address with special chars like “+” or “-” to identify services I subscribe.

Right now, the creation process is checked by some sort of regex that doesn’t take account of many subtleties of foreign languages, or more simply, of the authorized characters from the RFC 5322 ( http://www.rfc-editor.org/rfc/rfc5322.txt -> 3.4. Address Specification)

Thankfully, there is a PHP native function “filter_var” with the “FILTER_VALIDATE_EMAIL” filter, which is designed to answer these problems.
I wrote a patch to implement this function and it works with still some issues.
Works only with domain name filled. (Fails when @ll domains selected)
caveat when localpart starts with ‘=’ character

As I am not a developer I still try to figure out why it fails on those occasions.

I don’t know well how your dev team works but I opened a ticket on your bug tracker http://dev.nethserver.org/issues/3209 and got no answers. Maybe I will get more success here =)

(FYI, this function can also be used to validate ipv4/ipv6 addresses.)

1 Like

yep in regexp developers forgot “+” in email name :slight_smile: fork on Github maybe it would better :slight_smile:

Thanks @Vitellius,
we probably need to split the current validator to accomodate different use cases:

  • a generic (RFC compliant) mail address where system notifications are sent
  • defining a mail address on the system

What do you think?


Update: the proposed change has been scheduled for NethServer 7 alpha3

1 Like