', "\n", $message); $messageNew = preg_replace('/(.*)<\\/a>/', "$2: $1", $messageNew); return $messageNew; } function sendMail($email, $message, $subject, $title, $preheader): bool { include_once 'lib/phpmailer/Exception.php'; include_once 'lib/phpmailer/PHPMailer.php'; include_once 'lib/phpmailer/SMTP.php'; include_once 'app/HTML.php'; global $RUNTIME; $mailer = new PHPMailer(true); try { $mailer->isSMTP(); $mailer->Host = $RUNTIME['SMTP']['SERVER']; $mailer->Port = $RUNTIME['SMTP']['PORT']; $mailer->Username = $RUNTIME['SMTP']['ADDRESS']; $mailer->Password = $RUNTIME['SMTP']['PASS']; $mailer->SMTPAuth = true; $mailer->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; $mailer->setFrom($RUNTIME['SMTP']['ADDRESS'], $RUNTIME['SMTP']['NAME']); $mailer->addAddress($email); $mailer->isHTML(true); $mailer->Subject = $subject; $mailHtml = new HTML(); $mailHtml->importHTML("mail.html"); $mailHtml->setHTMLTitle($title); $mailHtml->ReplaceLayoutInhalt('%%MESSAGE%%', $message); $mailHtml->ReplaceLayoutInhalt('%%PREHEADER%%', $preheader); $mailHtml->build(); $mailer->Body = $mailHtml->ausgabe(); $mailer->AltBody = htmlToPlain($message); $mailer->send(); return true; } catch(Exception $e) { error_log('Could not send email: '.$mailer->ErrorInfo); return false; } } function getDataFromHTTP($url, $content = "", $requestTyp = "application/text") { try { if ($content != "") { return file_get_contents($url, true, stream_context_create(array('http' => array('header' => 'Content-type: '.$requestTyp, 'method' => 'POST', 'timeout' => 0.5, 'content' => $content)))); } else { return file_get_contents($url); } } catch (Exception $e) { echo "(HTTP REQUEST) error while conntect to remote server. : ".$url; } } function sendInworldIM($fromUUID, $toUUID, $fromName, $targetURL, $text) { $rawXML = "grid_instant_messageposition_x0position_y0position_z0to_agent_id".$toUUID."from_agent_session00000000-0000-0000-0000-000000000000im_session_id".$fromUUID."from_agent_name".$fromName."from_agent_id".$fromUUID."binary_bucketAA==region_handle0region_id00000000-0000-0000-0000-000000000000parent_estate_id1timestamp".time()."dialogAA==offlineAA==from_groupFALSEmessage".$text.""; getDataFromHTTP($targetURL, $rawXML, "text/xml"); }