";
}
if (strlen(utf8_decode($user)) < 3) {
$error = true;
$errorcode .= "Ungültiger Nutzer.
";
}
if (strlen(utf8_decode($desc)) < 3) {
$error = true;
$errorcode .= "Ungültige Nachricht.
";
}
if (!$error) {
$error = !mail(
$ini["mail_target"],
"RequestForm: Anfrage von $user",
$desc,
implode("\r\n", array(
"MIME-Version: 1.0",
"Content-type: text/plain; charset=utf-8",
"From: " . $ini["mail_noreply"],
"Reply-To: $user <$email>",
"X-Mailer: PHP/" . phpversion(),
))
);
if ($error) {
$errorcode .= "Serverseitiges Problem.";
$gotify_data = [
"title" => "RequestForm: Error",
"message" => "Mail transfer failed.",
"priority" => 1
];
} else {
$gotify_data = [
"title" => "RequestForm: Anfrage von $user",
"message" => $desc,
"priority" => 5
];
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $ini["gotify_url"]);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Content-Type: application/json; charset=utf-8"]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($gotify_data));
$result = curl_exec($ch);
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
switch ($code) {
case "200":
echo "Your Message was Submitted";
break;
case "400":
echo "Bad Request";
break;
case "401":
echo "Unauthorized Error - Invalid Token";
break;
case "403":
echo "Forbidden";
break;
case "404":
echo "API URL Not Found";
break;
default:
echo "Hmm Something Went Wrong or HTTP Status Code is Missing";
}
}
?>
= $errorcode ?>
Wenn der Fehler weiterhin besteht, sende die Anfrage mit deinem eigenen Mailclient ab:
?subject=Anfrage&body== $desc ?>">= $ini["mail_target"] ?>
Deine Nachricht ist im Link enthalten und muss nicht neu verfasst werden.