Index: modules/simpletest/tests/drupal_mail.inc
===================================================================
RCS file: modules/simpletest/tests/drupal_mail.inc
diff -N modules/simpletest/tests/drupal_mail.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/simpletest/tests/drupal_mail.inc	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,10 @@
+<?php
+/**
+ * Helperfunction to return the message.
+ *
+ * @param array $message
+ * @return array
+ */
+function drupal_mail_wrapper($message) {
+  return $message;
+}
Index: modules/simpletest/tests/drupal_mail.test
===================================================================
RCS file: modules/simpletest/tests/drupal_mail.test
diff -N modules/simpletest/tests/drupal_mail.test
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/simpletest/tests/drupal_mail.test	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,42 @@
+<?php
+class DrupalMailTestCase extends DrupalWebTestCase {
+
+  /**
+   * Implementation of getInfo().
+   *
+   */
+  function getInfo() {
+    return array(
+      'name' => t('Test Drupal mail functionality.'),
+      'description' => t('Test for drupal_mail().'),
+      'group' => t('Mail'),
+    );
+  }
+
+  /**
+   * Test to see if the smtp_library variable is set correctly.
+   */
+  function testMailSmtpVariable() {
+    $var = variable_get('smtp_library', 'empty');
+    $this->assertTrue(is_string($var), $var, 'drupal_mail_send');
+
+  }
+
+  /**
+   * Test to see if the wrapper function is executed correctly.
+   */
+  function testMailSend() {
+    // Set the smtp_library variable and get it again.
+    variable_set('smtp_library', drupal_get_path('module', 'simpletest') . '/tests/drupalmail.inc');
+    $smtp_wrapper = variable_get('smtp_library', 'none');
+    // Create the message array.
+    $message = array('headers' => array('Content-type'=> 'text/html'), 'subject' => 'drupal_mail_send test subject', 'to' => 'foobar@drupal.org', 'body' => 'foobar email');
+    // Execute the wrapper function by calling drupal_mail_send.
+    $response = drupal_mail_send( $message );
+    // Check the existence of the wrapper library file.
+    $this->assertTrue(file_exists($smtp_wrapper), t('Wrapper library file exists.') . $smtp_wrapper, 'drupal_mail_send');
+    // Check if the returned value is the same as the given value.
+    $this->assertEqual($response, $message, t('Message array is returned correctly.'), 'drupal_mail_send');
+  }
+
+}
