[Typo3-dev] Improvement of function validEmail($email)

Wolfgang Klinger wolfgang at stufenlos.net
Mon Mar 8 19:03:12 CET 2004


 Hi
On 17:31 Mon 08 Mar     , Stefan Geith wrote:
> I had the idea to check for an existing MX-Record in DNS,
> when validating an email-address. So only email-addresses
> with a valid domainname would be ok.  Good idea ?

 Good idea ;-)

 I already sent some improvements for this function to Kasper:

---
function validEmail($email) {                                                                                                                                                
    $email = trim ($email); 
    if (strstr($email,' '))  return FALSE;
    return
    ereg('^[A-Za-z0-9\._-]+[@][A-Za-z0-9\._-]*[\.].[A-Za-z0-9]+$',$email)
    ? true : false;
}     
---

 Addresses with ip and port are valid but not for the above function
 ,-(
 
 RFC: http://www.ietf.org/rfc/rfc0822.txt?number=822

 This is the ultimate e-mail validation regular expression:

 http://www.ex-parrot.com/~pdw/Mail-RFC822-Address.html

 *hehe*

 bye
 Wolfgang
 






More information about the TYPO3-dev mailing list