public function testtoString()
 {
     error_reporting(E_ERROR | E_PARSE);
     $emailMan = new EmailMan();
     //execute the method without setting attributes and verify that it retunrs expected results
     $expected = "EmailMan:\nid =  ,user_id=  module =  , related_id =  , related_type =  ,list_id = , send_date_time= \n";
     $actual = $emailMan->toString();
     $this->assertSame($expected, $actual);
     //execute the method with attributes set and verify that it retunrs expected results
     $emailMan->id = 1;
     $emailMan->user_id = 1;
     $emailMan->module = 'test';
     $emailMan->related_id = 1;
     $emailMan->related_type = 'test';
     $emailMan->list_id = 1;
     $emailMan->send_date_time = '1/1/2015';
     $expected = "EmailMan:\nid = 1 ,user_id= 1 module = test , related_id = 1 , related_type = test ,list_id = 1, send_date_time= 1/1/2015\n";
     $actual = $emailMan->toString();
     $this->assertSame($expected, $actual);
 }
                    $email_query .= " select email1 from leads join prospect_lists_prospects on related_id = leads.id and related_type='Leads' and prospect_list_id = '{$row1['prospect_list_id']}' and prospect_lists_prospects.deleted=0";
                    $email_query .= " union ";
                    $email_query .= " select email1 from users join prospect_lists_prospects on related_id = users.id and related_type='Users' and prospect_list_id = '{$row1['prospect_list_id']}' and prospect_lists_prospects.deleted=0";
                    $email_query_result = $db->query($email_query);
                    while ($email_address = $db->fetchByAssoc($email_query_result)) {
                        $emailman->restricted_addresses[strtolower($email_address['email1'])] = 1;
                    }
                }
            }
        }
        if (!$emailman->sendEmail($mail, $test)) {
            emaillog("FAILURE:");
        } else {
            emaillog("SUCCESS:");
        }
        emaillog($emailman->toString());
        if ($mail->isError()) {
            emaillog($mail->ErrorInfo);
        }
    }
    $send_all = $send_all ? !$no_items_in_queue : $send_all;
} while ($send_all == true);
if ($admin->settings['mail_sendtype'] == "SMTP") {
    $mail->SMTPClose();
}
if (isset($temp_user)) {
    $current_user = $temp_user;
}
if (isset($_REQUEST['return_module']) && isset($_REQUEST['return_action']) && isset($_REQUEST['return_id'])) {
    header("Location: index.php?module={$_REQUEST['return_module']}&action={$_REQUEST['return_action']}&record={$_REQUEST['return_id']}");
} else {