3.227.252.87 |    

Navigation

Google Advertisement

Diese Funktion prüft die Syntax einer Email Adresse. Dabei wird auch geprüft, ob die Email Adresse einen gültigen A und MX Record im DNS besitzt. Für die Prüfung ist eine Hostauflösung (Internetzugang) nötig.

checkmail
  1. //
  2. // if ( checkmail( $_POST['email'] ) !== True ) {
  3. //     echo "ERROR: You have insert an invalid mail address!";
  4. // }
  5. //
  6. // ***************************************************************
  7. // This function check the syntax of an mail address and the
  8. // DNS entry (A-Record, MX-Record) of a mail domain.
  9.  
  10. function checkmail ( $email = Null ) {
  11.  
  12. list( $user, $host ) = explode( "@", $email );
  13.  
  14. if ( !eregi ("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,})$", $email ) 
  15. 	or !checkdnsrr( $host, "MX" ) 
  16. 	or !checkdnsrr( $host, "A" ) ) {
  17. 	return False;
  18. } else {
  19. 	return True;
  20. }
  21.  
  22. }
  23.  
Parsed in 0.010 seconds at 63.02 KB/s

Search
 
Full text search by name and content of a snippet.

User online
There are 7 users online.

Tags Cloud

Latest snippets
str2seconds
(Bash::Function)
is_integer
(Bash::Function)
file_rotate
(Bash::Function)
confirm
(Bash::Function)
is_workingtime
(Bash::Function)
last day of last month
(Bash::Snippets)
crypt_apr1_md5
(PHP::Function)
crypt_apr1_md5
(Perl::Function)
transparent
(CSS)
rfc2822Toiso8601
(PHP::Function)