Documentation

check_email

bool
check_email(
  string email,
  bool Strict = false
);

Check e-mail address for syntax validity. Returns true, if the address syntax is correct, otherwise returns false.

Note. Email is checked as per RFC822. For example, test@test - is absolutely correct address in this respect. That is why, this function isn't suitable for checking format address in a traditional manner.

Function parameters

ParameterDescription Available from version
email Checked e-mail address.
Strict Optional; false by default. When bStrict = true
echo (check_email("Bitrix ")) ? "OK!" : "Error!"; // Error!

Examples of use

<?
echo (check_email("Bitrix <admin@bitrix.com>")) ? "OK!" : "Error!"; // OK
echo (check_email("mail@server.com")) ? "OK!" : "Error!"; // OK
echo (check_email("admin@bi$trix.com")) ? "OK!" : "Error!"; // ERROR
?>


© «Bitrix24», 2001-2024