View: Vérifier la validité d'une adresse email avec php

  1. 1 year ago by akyrho and saved by 2 others
    1. // Vérification de la forme
    2. function isEmail($email){
    3.  return preg_match("/^(\w|-|\.)+@((\w|-)+\.)+[a-z]{2,6}$/i", $email)
    4. }
    5.  
    6. // Domaine valide ?
    7. function isEmailDomaine($email){
    8.    list($compte,$domaine)=split('@',$email,2);
    9.    if(!checkdnsrr($domaine,'MX') && !checkdnsrr($domaine,'A')){
    10.      return false;
    11.    }else{
    12.      return true;
    13.    }

0 comment about "Vérifier la validité d'une adresse email avec php"