Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.756
diff -u -r1.756 common.inc
--- includes/common.inc	30 Jan 2008 23:07:41 -0000	1.756
+++ includes/common.inc	4 Feb 2008 15:01:33 -0000
@@ -810,16 +810,23 @@
  *
  * @param $mail
  *   A string containing an e-mail address.
+ * @param $allow_name
+ *   Optionally state if the email address can contain the name.
  * @return
  *   TRUE if the address is in a valid format.
  */
-function valid_email_address($mail) {
+function valid_email_address($mail, $allow_name = FALSE) {
+  $name = '((?:"[^\"\f\n\r\t\v]+" <))?';
+  $angle = '(?(1)>)';
   $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}';
 
-  return preg_match("/^$user@($domain|(\[($ipv4|$ipv6)\]))$/", $mail);
+  $addrspec = "$user@($domain|(\[($ipv4|$ipv6)\]))";
+  $mailbox = "$name$addrspec$angle";
+  $expression = $allow_name ? $mailbox : $addrspec;
+  return preg_match('/^'. $expression .'$/', $mail);
 }
 
 /**
Index: modules/system/system.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.admin.inc,v
retrieving revision 1.63
diff -u -r1.63 system.admin.inc
--- modules/system/system.admin.inc	4 Feb 2008 12:35:48 -0000	1.63
+++ modules/system/system.admin.inc	4 Feb 2008 14:58:39 -0000
@@ -1182,7 +1182,7 @@
  */
 function system_site_information_settings_validate($form, &$form_state) {
   // Validate the e-mail address.
-  if ($error = user_validate_mail($form_state['values']['site_mail'])) {
+  if ($error = user_validate_mail($form_state['values']['site_mail'], TRUE)) {
     form_set_error('site_mail', $error);
   }
   // Validate front page path.
Index: modules/user/user.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.module,v
retrieving revision 1.892
diff -u -r1.892 user.module
--- modules/user/user.module	3 Feb 2008 19:23:01 -0000	1.892
+++ modules/user/user.module	4 Feb 2008 15:01:56 -0000
@@ -397,9 +397,9 @@
   if (strlen($name) > USERNAME_MAX_LENGTH) return t('The username %name is too long: it must be %max characters or less.', array('%name' => $name, '%max' => USERNAME_MAX_LENGTH));
 }
 
-function user_validate_mail($mail) {
+function user_validate_mail($mail, $allow_name = FALSE) {
   if (!$mail) return t('You must enter an e-mail address.');
-  if (!valid_email_address($mail)) {
+  if (!valid_email_address($mail, $allow_name)) {
     return t('The e-mail address %mail is not valid.', array('%mail' => $mail));
   }
 }
