Index: ./modules/simpletest/tests/mail.test
===================================================================
RCS file: ./modules/simpletest/tests/mail.test
diff -N ./modules/simpletest/tests/mail.test
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ./modules/simpletest/tests/mail.test	25 Aug 2008 12:24:17 -0000
@@ -0,0 +1,38 @@
+<?php
+
+class MailTest extends DrupalWebTestCase {
+  /**
+   * Implementation of getInfo().
+   */
+  function getInfo() {
+    return array(
+      'name' => t('Mail functionality'),
+      'description' => t('Test Mail: check the default mail-from setting.'),
+      'group' => t('Mail')
+    );
+  }
+  
+  /**
+   * Implementation of setUp().
+   */
+  function setUp() {
+    parent::setUp('mail_test');
+    variable_set('site_mail', 'user@example.com');
+  }
+  
+  /**
+   * Implementation of tearDown().
+   */
+  function tearDown() {
+    parent::tearDown(); 
+  }
+  
+  function testDefaultSiteFrom() {
+    $account = $this->drupalCreateUser(array('access content'));
+    $default_from = variable_get('site_mail', ini_get('sendmail_from'));
+    
+    $message = drupal_mail('mail_test', 'notice', 'user@example.com', language_default(), array('account' => $account), NULL, FALSE);    
+    
+    $this->assertIdentical($default_from, $message['headers']['From'], t('testing equality of default-from setting'));
+  }
+}
Index: ./modules/simpletest/tests/mail_test.info
===================================================================
RCS file: ./modules/simpletest/tests/mail_test.info
diff -N ./modules/simpletest/tests/mail_test.info
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ./modules/simpletest/tests/mail_test.info	25 Aug 2008 12:24:17 -0000
@@ -0,0 +1,7 @@
+name = "Mail test"
+description = "Support module for mail testing."
+package = Testing
+version = VERSION
+core = 7.x
+files[] = mail_test.module
+hidden = TRUE
Index: ./modules/simpletest/tests/mail_test.module
===================================================================
RCS file: ./modules/simpletest/tests/mail_test.module
diff -N ./modules/simpletest/tests/mail_test.module
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ./modules/simpletest/tests/mail_test.module	25 Aug 2008 12:24:17 -0000
@@ -0,0 +1,15 @@
+<?php
+
+/**
+ * Implementation of hook_mail
+ */
+function mail_test_mail($key, &$message, $params) {
+  $language = $message['language'];
+  $variables = user_mail_tokens($params['account'], $language);
+  switch($key) {
+    case 'notice':
+    $message['subject'] = t('subject', $variables, $language->language);
+    $message['body'] = t('body', $variables, $language->language);
+    break;
+  }
+}
