51 lines
1.3 KiB
PHP
51 lines
1.3 KiB
PHP
<?php
|
|
|
|
include_once __DIR__ . '/../controller/DatabaseController.php';
|
|
include_once __DIR__ . '/../controller/DataController.php';
|
|
|
|
function sendMail($subject, $message, $url, bool $log, $to = "bruno.eckhardt07@gmail.com")
|
|
{
|
|
$headers = "From: bruno.eckhardt07@gmail.com\r\n";
|
|
mail(
|
|
$to,
|
|
$subject,
|
|
$message,
|
|
$headers
|
|
);
|
|
if ($log == true) {
|
|
DatabaseInsert(
|
|
"Mailing",
|
|
"DATUM, SUBJECT, MESSAGE, MAIL_AN, URL, CLIENT_IP",
|
|
(new getSpecificData())->getRequestTime(),
|
|
$subject,
|
|
$message,
|
|
$to,
|
|
$url,
|
|
(new getSpecificData())->getClientIP(),
|
|
);
|
|
}
|
|
}
|
|
|
|
function errorMail($title, $error, bool $log)
|
|
{
|
|
$headers = "From: bruno.eckhardt07@gmail.com\r\n";
|
|
$headers .= "MIME-Version: 1.0\r\n";
|
|
$headers .= "Content-Type: text/html; charset=UTF-8\r\n";
|
|
|
|
mail(
|
|
"bruno.eckhardt07@gmail.com",
|
|
"[ERROR] $title",
|
|
$error,
|
|
$headers,
|
|
);
|
|
if ($log == true) {
|
|
DatabaseInsert(
|
|
"Mailing",
|
|
"DATUM, SUBJECT, MESSAGE, URL, CLIENT_IP",
|
|
(new getSpecificData())->getRequestTime(),
|
|
"[ERROR] $title",
|
|
$error,
|
|
(new getSpecificData())->getClientIP(),
|
|
);
|
|
}
|
|
} |