diff -upN ../d7-patch/includes/common.inc includes/common.inc
--- ../d7-patch/includes/common.inc	2008-05-30 19:41:51.000000000 +0200
+++ includes/common.inc	2008-06-03 22:59:11.000000000 +0200
@@ -815,11 +815,16 @@ function t($string, $args = array(), $la
  */
 function valid_email_address($mail) {
   $user = '[a-zA-Z0-9_\-\.\+\^!#\$%&*+\/\=\?\`\|\{\}~\']+';
-  $domain = '(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.?)+';
-  $ipv4 = '[0-9]{1,3}(\.[0-9]{1,3}){3}';
-  $ipv6 = '[0-9a-fA-F]{1,4}(\:[0-9a-fA-F]{1,4}){7}';
+  $domain = '(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])';
+  $domain .= '(?:\.' . $domain . ')+';
 
-  return preg_match("/^$user@($domain|(\[($ipv4|$ipv6)\]))$/", $mail);
+  // We don't allow IP-based domains
+  $mail_domain = substr($mail, strpos($mail, '@') + 1);
+  if (is_numeric(str_replace('.', '', $mail_domain))) {
+    return FALSE;
+  }
+
+  return ($mail == '' || preg_match('/^' . $user . '@' . $domain . '$/', $mail));
 }
 
 /**
diff -upN ../d7-patch/includes/common.test includes/common.test
--- ../d7-patch/includes/common.test	1970-01-01 01:00:00.000000000 +0100
+++ includes/common.test	2008-06-03 23:03:15.000000000 +0200
@@ -0,0 +1,63 @@
+<?php
+// $Id$
+
+class CommonValidEmailAddressTestCase extends DrupalWebTestCase {
+
+  /**
+   * Implementation of getInfo().
+   */
+  function getInfo() {
+    return array(
+      'name' => t('Valid email address'),
+      'description' => t('Check predefined email addresses against valid_email_address().'),
+      'group' => t('System')
+    );
+  }
+
+  /**
+   * Implementation of setUp().
+   */
+  function setUp() {
+    $this->test_cases = array( // '<user@domain.ext>' => (bool)'<expected result>',
+      ''                    => TRUE,
+      'foo@x.com'           => TRUE,
+      'foo@1.com'           => TRUE,
+      'foo@example.com'     => TRUE,
+      'foo@example-foo.com' => TRUE,
+      'foo@example.co.uk'   => TRUE,
+      'foo@example.info'    => TRUE,
+      'foo@example.com.'    => FALSE,
+      'foo@example.com..'   => FALSE,
+      'foo@-example.com'    => FALSE,
+      'foo@example-.com'    => FALSE,
+      'foo@example-.'       => FALSE,
+      '@example.com'        => FALSE,
+      'foo@.example.com'    => FALSE,
+      'foo@example.com-'    => FALSE,
+      'foo@example'         => FALSE,
+      'foo@192.168.1.1'     => FALSE,
+      'foo@2001:0db8:85a3:08d3:1319:8a2e:0370:7334' => FALSE,
+    );
+    parent::setUp();
+  }
+
+  /**
+   * testCommonValidEmailAddress
+   */
+  function testCommonValidEmailAddress() {
+    foreach ($this->test_cases as $address => $expected) {
+      if ($expected === TRUE) {
+        $this->assertTrue(
+          (bool)valid_email_address($address),
+          "Checking valid email address: '". $address ."' %s"
+        );
+      }
+      else {
+        $this->assertFalse(
+          (bool)valid_email_address($address),
+          "Checking invalid email address: '". $address ."' %s"
+        );
+      }
+    }
+  }
+}
