Skip to content

Instantly share code, notes, and snippets.

@dagostoni
Last active October 19, 2021 00:38
Show Gist options
  • Save dagostoni/5510b8359ebec20fd861 to your computer and use it in GitHub Desktop.
Save dagostoni/5510b8359ebec20fd861 to your computer and use it in GitHub Desktop.
check mail / validate mail
<?php
static function isValidMail($mail){
if (!preg_match("/^([\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*[\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+@((((([a-z0-9]{1}[a-z0-9\-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,6})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)$/i", $mail)) {
return false;
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment