Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
To use Drupal's built-in email validation function for checking email addresses submitted through a web form, it's as simple as this:
$mail = $form_state['values']['submitted_tree']['email_address'];
if (!valid_email_address($mail)) {
form_set_error('[submitted][email_address]', t('The email address appears to be invalid.'));
}