Validate E-mail Addresses

Last updated on
30 April 2025

You are browsing documentation for an older version of Drupal, which is not supported any longer, and the information may not be correct. See current documentation for Contributed modules

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.'));
}

Help improve this page

Page status: Not set

You can: