Skip to content

Email validation doesn't allow emails which are compliant with RFC 6530 #931

@antony

Description

@antony

Context

  • node version: 5.11.1
  • joi version: 8.4.2
  • environment (node, browser): Node
  • used with (hapi, standalone, ...): Hapi
  • any other relevant information:

What are you trying to achieve or the steps to reproduce ?

  1. Attempt to validate a utf-8 email address such as: jØrgen@somedomain.com
  2. Get 'invalid' validation result

Note that this email is considered invalid, which is correct, but permitted by https://tools.ietf.org/html/rfc6530

const schema = Joi.string().email()

Which result you had ?

Email address was marked as invalid. This is a problem as I would now have to use a regexp or simple string validation for email addresses which significantly reduces readability.

What did you expect ?

I'd hope for some method of switching between RFC versions - perhaps by passing in the rfc number. I don't really have any other 'good solutions' for this.

Google, for example support sending and recieving from RFC 6530 emails, but not signing up with them - they would use something like:

const signupSchema = Joi.string().email({compliance: 'rfc5322'})
const sendingSchema = Joi.string().email({compliance: 'rfc6530'})

Of course compliance could be changed to international: true/false' or something similar, but I think compliance is more explicit.

Metadata

Metadata

Assignees

Labels

featureNew functionality or improvement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions