New bots Xmarks and spbot
[infodrom.org/www.zeitungsliste.de] / lib / extern / rfc822.php
1 <?php
2 ######################################################################################
3 #                                                                                    #
4 # RFC822 Email Parser                                                                #
5 # http://code.iamcal.com/php/rfc822/rfc822.phps                                      #
6 #                                                                                    #
7 # By Cal Henderson <cal@iamcal.com>                                                  #
8 # This code is licensed under a Creative Commons Attribution-ShareAlike 2.5 License  #
9 # http://creativecommons.org/licenses/by-sa/2.5/                                     #
10 #                                                                                    #
11 # Revision 2                                                                         #
12 #                                                                                    #
13 ######################################################################################
14
15
16 function is_valid_email_address($email){
17     $qtext = '[^\\x0d\\x22\\x5c\\x80-\\xff]';
18     $dtext = '[^\\x0d\\x5b-\\x5d\\x80-\\xff]';
19     $char = '[^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-\\x3c'.
20               '\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]';
21     $atom = "$char+";
22
23           $quoted_pair = '\\x5c[\\x00-\\x7f]';
24           $domain_literal = "\\x5b($dtext|$quoted_pair)*\\x5d";
25           $quoted_string = "\\x22($qtext|$quoted_pair)*\\x22";
26           $domain_ref = $atom;
27           $top_domain = "[a-zA-Z]{2,10}";
28           $sub_domain = "($domain_ref|$domain_literal)";
29           $word = "($atom|$quoted_string)";
30           $domain = "$sub_domain(\\x2e$sub_domain)*\\x2e$top_domain";
31           $local_part = "$word(\\x2e$word)*";
32           $addr_spec = "$local_part\\x40$domain";
33           return preg_match("!^$addr_spec$!", $email) ? 1 : 0;
34       }
35
36 ?>