? files
? sites/all/modules
? sites/default/settings.php
Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.647
diff -u -F^f -r1.647 common.inc
--- includes/common.inc	29 May 2007 14:37:49 -0000	1.647
+++ includes/common.inc	30 May 2007 20:46:16 -0000
@@ -2489,6 +2489,9 @@ function drupal_common_themes() {
     'date' => array(
       'arguments' => array('element' => NULL),
     ),
+    'mail' => array(
+      'arguments' => array('element' => NULL),
+    ),
     'item' => array(
       'arguments' => array('element' => NULL),
     ),
Index: includes/form.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/form.inc,v
retrieving revision 1.200
diff -u -F^f -r1.200 form.inc
--- includes/form.inc	28 May 2007 18:53:29 -0000	1.200
+++ includes/form.inc	30 May 2007 20:46:16 -0000
@@ -1242,6 +1242,23 @@ function password_confirm_validate($form
 }
 
 /**
+ * Validate an email element.
+ */
+function mail_validate($form) {
+  $mail = $form['#value'];
+  if ($mail && !valid_email_address($mail)) {
+    form_set_error($form['#name'], t('E-mail address is invalid.'));
+  }
+}
+
+/**
+ * Themes email textfields.
+ */
+function theme_mail($element) {
+  return theme('textfield', $element);
+}
+
+/**
  * Format a date selection element.
  *
  * @param $element
Index: modules/comment/comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v
retrieving revision 1.547
diff -u -F^f -r1.547 comment.module
--- modules/comment/comment.module	29 May 2007 06:27:37 -0000	1.547
+++ modules/comment/comment.module	30 May 2007 20:46:17 -0000
@@ -1429,12 +1429,7 @@ function comment_validate($edit) {
         form_set_error('name', t('You have to leave your name.'));
       }
 
-      if ($edit['mail']) {
-        if (!valid_email_address($edit['mail'])) {
-          form_set_error('mail', t('The e-mail address you specified is not valid.'));
-        }
-      }
-      else if (variable_get('comment_anonymous', COMMENT_ANONYMOUS_MAYNOT_CONTACT) == COMMENT_ANONYMOUS_MUST_CONTACT) {
+      if (!$edit['mail'] && variable_get('comment_anonymous', COMMENT_ANONYMOUS_MAYNOT_CONTACT) == COMMENT_ANONYMOUS_MUST_CONTACT) {
         form_set_error('mail', t('You have to leave an e-mail address.'));
       }
 
@@ -1523,7 +1518,7 @@ function comment_form($edit, $title = NU
           '#weight' => -1,
         );
         $form['admin']['mail'] = array(
-          '#type' => 'textfield',
+          '#type' => 'mail',
           '#title' => t('E-mail'),
           '#maxlength' => 64,
           '#size' => 30,
@@ -1555,7 +1550,7 @@ function comment_form($edit, $title = NU
     $form['name'] = array('#type' => 'textfield', '#title' => t('Your name'), '#maxlength' => 60, '#size' => 30, '#default_value' => $edit['name'] ? $edit['name'] : variable_get('anonymous', t('Anonymous'))
     );
 
-    $form['mail'] = array('#type' => 'textfield', '#title' => t('E-mail'), '#maxlength' => 64, '#size' => 30, '#default_value' => $edit['mail'], '#description' => t('The content of this field is kept private and will not be shown publicly.')
+    $form['mail'] = array('#type' => 'mail', '#title' => t('E-mail'), '#maxlength' => 64, '#size' => 30, '#default_value' => $edit['mail'], '#description' => t('The content of this field is kept private and will not be shown publicly.')
     );
 
     $form['homepage'] = array('#type' => 'textfield', '#title' => t('Homepage'), '#maxlength' => 255, '#size' => 30, '#default_value' => $edit['homepage']);
@@ -1563,7 +1558,7 @@ function comment_form($edit, $title = NU
   else if (variable_get('comment_anonymous', COMMENT_ANONYMOUS_MAYNOT_CONTACT) == COMMENT_ANONYMOUS_MUST_CONTACT) {
     $form['name'] = array('#type' => 'textfield', '#title' => t('Your name'), '#maxlength' => 60, '#size' => 30, '#default_value' => $edit['name'] ? $edit['name'] : variable_get('anonymous', t('Anonymous')), '#required' => TRUE);
 
-    $form['mail'] = array('#type' => 'textfield', '#title' => t('E-mail'), '#maxlength' => 64, '#size' => 30, '#default_value' => $edit['mail'], '#description' => t('The content of this field is kept private and will not be shown publicly.'), '#required' => TRUE);
+    $form['mail'] = array('#type' => 'mail', '#title' => t('E-mail'), '#maxlength' => 64, '#size' => 30, '#default_value' => $edit['mail'], '#description' => t('The content of this field is kept private and will not be shown publicly.'), '#required' => TRUE);
 
     $form['homepage'] = array('#type' => 'textfield', '#title' => t('Homepage'), '#maxlength' => 255, '#size' => 30, '#default_value' => $edit['homepage']);
   }
Index: modules/contact/contact.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/contact/contact.module,v
retrieving revision 1.85
diff -u -F^f -r1.85 contact.module
--- modules/contact/contact.module	28 May 2007 06:08:42 -0000	1.85
+++ modules/contact/contact.module	30 May 2007 20:46:17 -0000
@@ -441,7 +441,7 @@ function contact_mail_page() {
       '#default_value' => $user->uid ? $user->name : '',
       '#required' => TRUE,
     );
-    $form['mail'] = array('#type' => 'textfield',
+    $form['mail'] = array('#type' => 'mail',
       '#title' => t('Your e-mail address'),
       '#maxlength' => 255,
       '#default_value' => $user->uid ? $user->mail : '',
@@ -500,9 +500,6 @@ function contact_mail_page_validate($for
   if (!$form_values['cid']) {
     form_set_error('category', t('You must select a valid category.'));
   }
-  if (!valid_email_address($form_values['mail'])) {
-    form_set_error('mail', t('You must enter a valid e-mail address.'));
-  }
 }
 
 /**
Index: modules/system/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.module,v
retrieving revision 1.485
diff -u -F^f -r1.485 system.module
--- modules/system/system.module	30 May 2007 08:08:58 -0000	1.485
+++ modules/system/system.module	30 May 2007 20:46:18 -0000
@@ -110,6 +110,11 @@ function system_elements() {
   $type['select'] = array('#input' => TRUE, '#size' => 0, '#multiple' => FALSE);
   $type['weight'] = array('#input' => TRUE, '#delta' => 10, '#default_value' => 0, '#process' => array('process_weight'));
   $type['date'] = array('#input' => TRUE, '#process' => array('expand_date' => array()), '#element_validate' => array('date_validate'));
+  $type['mail'] = array(
+    '#input' => TRUE,
+    '#type' => 'textfield',
+    '#element_validate' => array('mail_validate'),
+  );
   $type['file'] = array('#input' => TRUE, '#size' => 60);
 
   // Form structure
@@ -553,7 +558,7 @@ function system_site_information_setting
     '#required' => TRUE
   );
   $form['site_mail'] = array(
-    '#type' => 'textfield',
+    '#type' => 'mail',
     '#title' => t('E-mail address'),
     '#default_value' => variable_get('site_mail', ini_get('sendmail_from')),
     '#description' => t('A valid e-mail address to be used as the "From" address by the auto-mailer during registration, new password requests, notifications, etc.  To lessen the likelihood of e-mail being marked as spam, this e-mail address should use the same domain as the website.'),
