diff --git a/mimemail.inc b/mimemail.inc
index dece76a..2f1a7ae 100644
--- a/mimemail.inc
+++ b/mimemail.inc
@@ -64,7 +64,7 @@ function mimemail_headers($headers, $from = NULL) {
     }
     // This may not work. The MTA may rewrite the Return-Path.
     if (!isset($headers['Return-Path']) || $headers['Return-Path'] == $default_from) {
-      preg_match('/[a-z0-9\-\.\+_]+@{1}[a-z0-9\-\.]+/i', $from, $matches);
+      preg_match('/[a-z\d\-\.\+_]+@(?:[a-z\d\-]+\.)+[a-z\d]{2,4}/i', $from, $matches);
       $headers['Return-Path'] = "<$matches[0]>";
     }
   }
diff --git a/tests/mimemail.test b/tests/mimemail.test
index c766e4b..05bae5c 100644
--- a/tests/mimemail.test
+++ b/tests/mimemail.test
@@ -26,6 +26,18 @@ class MimeMailUnitTestCase extends DrupalUnitTestCase {
     parent::setUp();
   }
 
+  function testHeaders() {
+    // Test the regular expression for extracting the mail address.
+    $chars = array('-', '.', '+', '_');
+    $name = $this->randomString();
+    $local = $this->randomName() . $chars[array_rand($chars)] . $this->randomName();
+    $domain = $this->randomName() . '-' . $this->randomName() . '.' . $this->randomName(rand(2,4));
+    $headers = mimemail_headers(array(), "$name <$local@$domain>");
+    $result = $headers['Return-Path'];
+    $expected = "<$local@$domain>";
+    $this->assertIdentical($result, $expected, 'Return-Path header field correctly set.');
+  }
+
   function testUrl() {
     $result = _mimemail_url('#');
     $this->assertIdentical($result, '#', 'Hash mark URL without fragment left intact.');
