static function SendTestMail($amount = 0)
 {
     Logging::SecurityLog("ServerManager::SendTestMail", "", CALLER_SYSTEM_ID);
     if (OperatorRequest::IsValidated() && OperatorRequest::IsAdministrator(true)) {
         $account = Mailbox::GetById($_POST["p_mailbox"]);
         try {
             if ($account->Type == "IMAP" || $account->Type == "POP") {
                 $reload = false;
                 $amount = $account->Download($reload, false, true);
                 $return = 1;
             } else {
                 $return = Communication::SendEmail($account, $account->Email, $account->Email, "LiveZilla Test Mail", "", "LiveZilla Test Mail", true);
             }
         } catch (Exception $e) {
             Logging::GeneralLog(serialize($e));
             $return = $e->getMessage();
         }
         if (is_array($amount)) {
             $amount = count($amount);
         }
         if ($return == 1) {
             Server::$Response->SetStandardResponse(1, base64_encode($amount));
         } else {
             Server::$Response->SetStandardResponse(2, base64_encode($return));
         }
     }
 }
 function SendStatusEmail()
 {
     Server::InitDataBlock(array("DBCONFIG"));
     if (!empty(Server::$Configuration->Database["cct"][$this->TypeId])) {
         $loc = Server::$Configuration->Database["cct"][$this->TypeId]->GetLocalization($this->Language);
         if ($loc != null && !empty($loc->EmailVoucherUpdate)) {
             $email = $loc->EmailVoucherUpdate;
             $email = str_replace("%buyer_first_name%", $this->Firstname, $email);
             $email = str_replace("%buyer_last_name%", $this->Lastname, $email);
             $email = str_replace("%voucher_code%", $this->Id, $email);
             $email = str_replace("%voucher_remaining_time%", $this->ChatTimeRemaining == -1 ? "-" : ($this->ChatTimeRemaining >= 0 ? SystemTime::FormatTimeSpan($this->ChatTimeRemaining) : SystemTime::FormatTimeSpan(0)), $email);
             $email = str_replace("%voucher_remaining_sessions%", $this->ChatSessionsMax == -1 ? "-" : ($this->ChatSessionsMax - $this->ChatSessions >= 0 ? $this->ChatSessionsMax - $this->ChatSessions : 0), $email);
             $email = str_replace("%voucher_expiration_date%", $this->VoucherAutoExpire == -1 ? "-" : date("r", $this->VoucherAutoExpire), $email);
             $email = str_replace("%website_name%", Server::$Configuration->File["gl_site_name"], $email);
             $defmailbox = Mailbox::GetDefaultOutgoing();
             if ($defmailbox != null) {
                 Communication::SendEmail($defmailbox, $this->Email, $defmailbox->Email, $email, "", LocalizationManager::$TranslationStrings["client_voucher_email_subject_status_update"]);
             }
         }
     }
 }