Welcome Guest, Not a member yet? Register   Sign In
Email validation function does not allow underscore in email domain
#1

[eluser]Nathan Pitman (Nine Four)[/eluser]
It seems that the email validation built into the form validation function (http://ellislab.com/codeigniter/user-gui...ation.html) does not allow an email domain with an underscore despite this apparently being valid (http://en.wikipedia.org/wiki/Email_address#Syntax)?
#2

[eluser]danmontgomery[/eluser]
Underscores aren't permitted in domain names. If you read the article you linked to:

Quote:The local-part of the e-mail address may use any of these ASCII characters:
#3

[eluser]WanWizard[/eluser]
According to the regex used, it DOES allow un underscore in the local part of the email address, but NOT in the domain name part. This is correct as per RFC 1123.

The wikipedia link describes the syntax of the local part, the mailbox name. A bit further, it confirms my statement:
Quote:The domain name part of an email address has to conform to strict guidelines: it must match the requirements for a hostname, consisting of letters, digits, hyphens and dots.
#4

[eluser]Nathan Pitman (Nine Four)[/eluser]
Ah! Well caught! Interestingly I have a client who uses a domain name with an underscore but it's a sub domain so perhaps in this situation it's permitted?
#5

[eluser]smilie[/eluser]
Nope, valid subdomains do not support underscores either... So I do not know how it works for your client... :/

Cheers,
Smilie
#6

[eluser]WanWizard[/eluser]
If your client runs a Microsoft (or compliant, for example Infoblox) DNS service, it's possible to create hostnames with underscores, as this is used internally by Microsoft systems to announce services to the network.

I hope any internet facing DNS provider will not allow this...




Theme © iAndrew 2016 - Forum software by © MyBB