1<?php
2// $Id$
3
4// Try to remove antispam bits from the address
5function clean_antispam($email)
6{
7    $remove_spam = "![-_]?(NO|I[-_]?HATE|DELETE|REMOVE)[-_]?(THIS)?(ME|SPAM)?[-_]?!i";
8    return preg_replace($remove_spam, "", trim($email));
9}
10
11// Try to check that this email address is valid
12function is_emailable_address($email)
13{
14    // Exclude our mailing list hosting servers
15    $hosts_regex = "!(lists\.php\.net)!i";
16    $excluded_hosts = preg_match($hosts_regex, $email);
17
18    if (!$excluded_hosts && !empty($email)) {
19        return filter_var($email, FILTER_VALIDATE_EMAIL) == $email;
20    } else {
21        return FALSE;
22    }
23}
24