A
A
Aleksandr Mykoliuk2015-05-07 17:15:18
Standardization
Aleksandr Mykoliuk, 2015-05-07 17:15:18

Is there a standard for writing (validating) a mail address?

Faced with the problem of validating the user's mail. What to skip, what not to skip? What characters can theoretically contain an email address in order to protect the user from mistakes as much as possible?
It turns out that Cyrillic domains for mail have already appeared (pochta.rf, for example), but we don’t let them through at all, and who knows, maybe some important person won’t be able to get to us because of this :)
I think , maybe there is some international up-to-date standard for validating a postal address?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Evgeny Petrov, 2015-05-07
@mekal

Of course, there is the RFC822 standard . But... When you look at a regular expression that checks for a full match, you'll have enough kondrash. For the most unexpected place.
In fact, you will not need this correspondence, since most mail services introduce their own strict restrictions, and you will never meet most of the addresses that are valid from the point of view of the standard.
Take a look at these pages to understand what you need to check
Never check e-mail addresses according to RFC standards
Stop checking Email with regular...

C
CodeInside, 2015-05-07
@CodeInside

How do I do it:

if (filter_var($email, FILTER_VALIDATE_EMAIL) == false) 
 	{$error = true;
 		$text = 'некорректно введён адрес эллектронной почты.';
 	}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question