Validating an Email Address in Drupal
Ran into a situation earlier today where I needed to validate a Drupal username and email address entered into a custom form that would create a Drupal 6 User account (see http://codekarate.com/content/create-user-account-drupal-6-programmatically for more information on the submit handler of the form). There are easy to use Drupal functions to validate the username and email addresses. See the examples below:
//check if this is a valid Drupal username user_validate_name('USERNAME'); //check if this is a valid email address user_validate_mail('firstname.lastname@example.org');
These two functions helped a lot in my validation handler and hopefully they can help you.