Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

non-latin email address validation

Now that ICann is allowing non-latin-character domain names, should I be concerned about e-mail validation? Currently, my sites are using php functions to ensure some alpha-numeric character set in each segment of an email address. Will these other character sets, such as Cyrillic, Arabic, and Chinese, pass validation? Are there recommended php functions to utilize for this?

like image 609
Eric Di Bari Avatar asked May 24 '10 18:05

Eric Di Bari


People also ask

Which are the two different ways t validate email addresses?

Different ways in which Email Validation can be done:Use a third party tool like Clearout and Pabbly Email Verification that can give you real-time feedback of whether an email address is correct or not. 3. Double opt-in is the best way to validate email addresses.

What special characters are allowed in email address?

The local-part of the email address may use any of these ASCII characters: uppercase and lowercase Latin letters A to Z and a to z ; digits 0 to 9 ; special characters !

Can email addresses have non ASCII characters?

Nowadays, creating email addresses using non-ASCII characters is fortunately possible, as many email servers support the newer IETF standards.


1 Answers

I think the ultimately best way would be using a proper IDN function to convert the incoming string into an ACE string (xn--xyz-blah.com). If that process works, the domain name is valid. If it doesn't, it isn't.

There is a PHP function named idn_to_ascii() that does this, but it needs additional libraries. You'd have to see whether it is available on your system.

There also seems to be an external Linux command named idn that does IDN conversions. I don't know anything further about it, though.

If you want to use PHP built-in methods only, delfuego provides a regular expression in this question that looks very good.

like image 69
Pekka Avatar answered Sep 19 '22 12:09

Pekka