function SendEmail() { if ($this->Account == null) { $this->Account = Mailbox::GetDefaultOutgoing(); } if ($this->Account == null) { return null; } if ($this->Account->Type == "SMTP") { if ($this->Account->Framework == "PHP_MAILER") { return false; } else { $this->Result = $this->SEND_SMTP_ZEND(); } } else { if ($this->Account->Type == "PHPMail") { $this->Result = $this->SEND_PHP_MAIL($this->Receiver); } } }
function SendEmail($_fakeSender = "") { if ($this->Mailbox == null) { $this->Mailbox = Mailbox::GetDefaultOutgoing(); } if ($this->Mailbox == null) { return null; } $this->FakeSender = $_fakeSender; if ($this->Mailbox->Type == "SMTP") { if ($this->Mailbox->Framework == "PHP_MAILER") { return false; } else { $this->Result = $this->SEND_SMTP_ZEND(); } } else { if ($this->Mailbox->Type == "PHPMail") { $this->Result = $this->SEND_PHP_MAIL($this->Receiver); } } }
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"]); } } } }
static function SendTicketAutoresponder($_ticket, $_language, $_customs = true, $details = "", $cv = "", $pdm = null) { global $INPUTS, $CONFIG, $GROUPS; $message = "%details%\r\n\r\n%mailtext%\r\n\r\n"; $wordcount = str_words_count($message); if (!empty($GROUPS[$_ticket->Group]->PredefinedMessages)) { $pdm = getPredefinedMessage($GROUPS[$_ticket->Group]->PredefinedMessages, $_language); if (!empty($pdm->EmailTicket)) { $message = $pdm->EmailTicket; } } if ($INPUTS[111]->Active && !empty($_ticket->Messages[0]->Fullname)) { $details .= strip_tags($INPUTS[111]->Caption) . " " . $_ticket->Messages[0]->Fullname . "\r\n"; } if (!empty($_ticket->Email)) { $details .= strip_tags($INPUTS[112]->Caption) . " " . $_ticket->Messages[0]->Email . "\r\n"; } if ($INPUTS[113]->Active && !empty($_ticket->Messages[0]->Company)) { $details .= strip_tags($INPUTS[113]->Caption) . " " . $_ticket->Messages[0]->Company . "\r\n"; } if (($INPUTS[116]->Active || $_ticket->Messages[0]->CallMeBack) && !empty($_ticket->Messages[0]->Phone)) { $details .= strip_tags($INPUTS[116]->Caption) . " " . $_ticket->Messages[0]->Phone . "\r\n"; } $message = str_replace("%mailtext%", $_ticket->Messages[0]->Text, $message); $message = str_replace("%external_phone%", $_ticket->Messages[0]->Phone, $message); $message = str_replace("%external_name%", $_ticket->Messages[0]->Fullname, $message); $message = str_replace("%external_email%", $_ticket->Messages[0]->Email, $message); $message = str_replace("%website_name%", $CONFIG["gl_site_name"], $message); if ($_customs && ++$wordcount > 0) { foreach ($INPUTS as $index => $input) { if ($input->Active && $input->Custom && !isset($_ticket->Group->TicketInputsHidden[$index])) { if ($input->Type == "CheckBox") { $details .= strip_tags($input->Caption) . " " . ($cv = !empty($_ticket->Messages[0]->Customs[$index]) ? "<!--lang_client_yes-->" : "<!--lang_client_no-->") . "\r\n"; } else { if (!empty($_ticket->Messages[0]->Customs[$index]) || $input->Type == "ComboBox") { $details .= strip_tags($input->Caption) . " " . ($cv = $input->GetClientValue($_ticket->Messages[0]->Customs[$index])) . "\r\n"; } } $message = str_replace("%custom" . $index . "%", $cv, $message); } } } $message = str_replace("%localdate%", date("r"), $message); $message = str_replace(array("%group_name%", "%group_id%"), $_ticket->Group, $message); $message = str_replace("%group_description%", $GROUPS[$_ticket->Group]->GetDescription($_ticket->Language), $message); $message = str_replace("%details%", $details, $message); $message = str_replace("%external_ip%", getIP(), $message); $message = str_replace("%ticket_id%", $_ticket->Id, $message); $mailbox = Mailbox::GetDefaultOutgoing(); $_ticket->SendAutoresponder($mailbox, applyReplacements($message), $pdm, array()); }
function sendChatTranscripts($_custom = false) { global $CONFIG, $INTERNAL, $GROUPS, $INPUTS; initData(array("INTERNAL", "INPUTS")); closeChats(); $defmailbox = Mailbox::GetDefaultOutgoing(); $result = queryDB(false, "SELECT `voucher_id`,`subject`,`customs`,`internal_id`,`transcript_text`,`transcript_receiver`,`email`,`chat_id`,`fullname`,`group_id` FROM `" . DB_PREFIX . DATABASE_CHAT_ARCHIVE . "` WHERE `chat_type`=1 AND `endtime`>0 AND `closed`>0 AND `transcript_sent`=0 LIMIT 1;"); if ($result) { while ($row = DBManager::FetchArray($result)) { if (empty($row["transcript_text"])) { continue; } queryDB(true, "UPDATE `" . DB_PREFIX . DATABASE_CHAT_ARCHIVE . "` SET `transcript_sent`=1 WHERE `chat_id`='" . DBManager::RealEscape($row["chat_id"]) . "' LIMIT 1;"); $rcvs = str_replace(array("%fullname%", "%efullname%"), $row["fullname"], $row["transcript_text"]); $rcvs = str_replace(array("%email%", "%eemail%"), $row["email"], $rcvs); $rcvs = str_replace("%rating%", getRatingAVGFromChatId($row["chat_id"]), $rcvs); $subject = $row["subject"]; $customs = @unserialize($row["customs"]); $fakeSender = ""; foreach ($INPUTS as $index => $input) { if ($input->Active && $input->Custom && !isset($GROUPS[$row["group_id"]]->TicketInputsHidden[$index])) { $cv = ""; if ($input->Type == "CheckBox") { $cv = !empty($customs[$input->Name]) ? "<!--lang_client_yes-->" : "<!--lang_client_no-->"; } else { if (!empty($customs[$input->Name]) || $input->Type == "ComboBox") { $cv = $input->GetClientValue(@$customs[$input->Name]); } } $rcvs = str_replace("%custom" . $index . "%", $cv, $rcvs); } } $rcvs = applyReplacements($rcvs); $rcvs = Mailbox::FinalizeEmail($rcvs . "\r\n\r\n<!--lz_ref_link-->"); $mailbox = null; if (!empty($row["group_id"]) && isset($GROUPS[$row["group_id"]]) && !empty($GROUPS[$row["group_id"]]->ChatEmailOut)) { $mailbox = Mailbox::GetById($GROUPS[$row["group_id"]]->ChatEmailOut); } $mailbox = !empty($mailbox) ? $mailbox : $defmailbox; if ((!empty($CONFIG["gl_soct"]) || $_custom) && !empty($row["transcript_receiver"])) { sendMail($mailbox, $row["transcript_receiver"], $mailbox->Email, $rcvs, $subject); } if (!empty($CONFIG["gl_scto"]) && !$_custom) { initData(array("INTERNAL")); $receivers = array(); $resulti = queryDB(true, "SELECT `sender`,`receiver` FROM `" . DB_PREFIX . DATABASE_POSTS . "` WHERE `chat_id`='" . DBManager::RealEscape($row["chat_id"]) . "';"); if ($resulti) { while ($rowi = DBManager::FetchArray($resulti)) { if (!empty($INTERNAL[$rowi["sender"]]) && !in_array($rowi["sender"], $receivers)) { $receivers[] = $rowi["sender"]; } else { if (!empty($INTERNAL[$rowi["receiver"]]) && !in_array($rowi["receiver"], $receivers)) { $receivers[] = $rowi["receiver"]; } else { continue; } } sendMail($mailbox, $INTERNAL[$receivers[count($receivers) - 1]]->Email, $mailbox->Email, $rcvs, $subject); } } } if (!empty($CONFIG["gl_sctg"]) && !$_custom) { initData(array("GROUPS")); sendMail($mailbox, $GROUPS[$row["group_id"]]->Email, $mailbox->Email, $rcvs, $subject); } if (!empty($mailbox) && !empty($CONFIG["gl_scct"])) { if (!empty($CONFIG["gl_uvec"])) { if (Mailbox::IsValidEmail($row["transcript_receiver"])) { $fakeSender = $row["transcript_receiver"]; } else { if (Mailbox::IsValidEmail($row["email"])) { $fakeSender = $row["email"]; } } } sendMail($mailbox, $CONFIG["gl_scct"], $mailbox->Email, $rcvs, $subject, false, null, $fakeSender); } if (!empty($row["voucher_id"])) { $ticket = new CommercialChatVoucher(null, $row["voucher_id"]); $ticket->Load(); $ticket->SendStatusEmail(); } } } if (!empty($CONFIG["gl_rm_chats"]) && $CONFIG["gl_rm_chats_time"] == 0) { queryDB(true, "DELETE FROM `" . DB_PREFIX . DATABASE_CHAT_ARCHIVE . "` WHERE `transcript_sent` = '1';"); } }
function SendStatusEmail() { global $CONFIG, $LZLANG; if (!empty($CONFIG["db"]["cct"][$this->TypeId])) { $loc = $CONFIG["db"]["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 ? formatTimeSpan($this->ChatTimeRemaining) : 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%", $CONFIG["gl_site_name"], $email); $defmailbox = Mailbox::GetDefaultOutgoing(); if ($defmailbox != null) { sendMail($defmailbox, $this->Email, $defmailbox->Email, $email, $LZLANG["client_voucher_email_subject_status_update"]); } } } }