function results_email($project_id, $release_id, $build_id, $testset_id, $test_id, $recipients, $action)
{
    $display_generic_info = true;
    $display_generic_url = true;
    $generic_url = RTH_URL . "login.php?project_id={$project_id}&page=results_test_run_page.php&release_id={$release_id}&build_id={$build_id}&testset_id={$testset_id}&test_id={$test_id}";
    $username = session_get_username();
    $project_name = session_get_project_name();
    $release_name = admin_get_release_name($release_id);
    $build_name = admin_get_build_name($build_id);
    $testset_name = admin_get_testset_name($testset_id);
    $user_details = user_get_name_by_username($username);
    $first_name = $user_details[USER_FNAME];
    $last_name = $user_details[USER_LNAME];
    $row_test_detail = testset_query_test_details($testset_id, $test_id);
    $test_name = $row_test_detail[TEST_NAME];
    $status = $row_test_detail[TEST_TS_ASSOC_STATUS];
    $finished = $row_test_detail[TEST_TS_ASSOC_FINISHED];
    $assigned_to = $row_test_detail[TEST_TS_ASSOC_ASSIGNED_TO];
    $comments = $row_test_detail[TEST_TS_ASSOC_COMMENTS];
    $root_cause = $row_test_detail[TEST_RESULTS_ROOT_CAUSE];
    # CREATE EMAIL SUBJECT AND MESSAGE
    switch ($action) {
        case "test_run":
            $subject = "RTH: Test Run Notification - {$test_name}";
            $message = "Test {$test_name} has been run by {$first_name} {$last_name}\n" . NEWLINE;
            break;
        case "update_test_result":
            $subject = "RTH: Test Result has been Updated";
            $message = "The test result for {$test_name} has been updated by {$first_name} {$last_name}\n" . NEWLINE;
            break;
    }
    # Generic link to results page if the $generic_url variable has been set
    if ($display_generic_url) {
        $message .= "Click the following link to view the Test Results:" . NEWLINE;
        $message .= "{$generic_url}\n" . NEWLINE;
    }
    if ($display_generic_info) {
        $message .= "Project Name: {$project_name}\r" . NEWLINE;
        $message .= "Release Name: {$release_name}\r" . NEWLINE;
        $message .= "Build Name: {$build_name}\r" . NEWLINE;
        $message .= "TestSet Name: {$testset_name}\r\n\r" . NEWLINE;
        $message .= "Test Name: {$test_name}\r" . NEWLINE;
        $message .= "Status: {$status}\r" . NEWLINE;
        if (!empty($root_cause)) {
            $message .= "Root Cause: {$root_cause}\r" . NEWLINE;
        }
        $message .= "Comments: {$comments}\r\n\r" . NEWLINE;
    }
    email_send($recipients, $subject, $message);
}
$s_test_id = $s_results['test_id'];
$s_testset_id = $s_results['testset_id'];
$page = basename(__FILE__);
$action_page = "results_update_test_result_action.php";
html_window_title();
html_print_body();
html_page_title($project_name . " - " . lang_get('update_test_result_page'));
html_page_header($db, $project_name);
html_print_menu();
print "<br>" . NEWLINE;
error_report_check($_GET);
print "<div align=center>" . NEWLINE;
print "<form method=post action={$action_page}>" . NEWLINE;
print "<input type='hidden' name='testset_id' value='{$_GET['testset_id']}'>" . NEWLINE;
print "<input type='hidden' name='test_id' value='{$_GET['test_id']}'>" . NEWLINE;
$row_test_detail = testset_query_test_details($s_testset_id, $s_test_id);
if (!empty($row_test_detail)) {
    $test_id = $row_test_detail[TEST_ID];
    $testset_id = $row_test_detail[TS_ID];
    $test_name = $row_test_detail[TEST_NAME];
    $status = $row_test_detail[TEST_TS_ASSOC_STATUS];
    $finished = $row_test_detail[TEST_TS_ASSOC_FINISHED];
    $assigned_to = $row_test_detail[TEST_TS_ASSOC_ASSIGNED_TO];
    $comments = $row_test_detail[TEST_TS_ASSOC_COMMENTS];
    $root_cause = $row_test_detail[TEST_RESULTS_ROOT_CAUSE];
    print "<table class=width60>" . NEWLINE;
    print "<tr>" . NEWLINE;
    print "<td>" . NEWLINE;
    print "<table class=inner rules=none border=0>" . NEWLINE;
    print "<tr>" . NEWLINE;
    print "<td class=form-header-l colspan=2>" . lang_get('update_test_result_form') . "</td>" . NEWLINE;