Hallo Regina
Meinst Du es so?
<?php
// E-Mail Sender und Empfänger festlegen
$mail_from = "mail@example.org"; // <== Sender. Anpassen!
$mail_to = "mail@example.org"; // <== Empfänger: Ihre E-Mail-Adresse!
// E-Mail: Format ist HTML utf8
$mail_extras = "From: Error-Manager <$mail_from>\n";
$mail_extras .= "Content-Type: text/plain; charset=utf-8\n";
$mail_extras .= "Content-Transfer-Encoding: 8bit\n";
$mail_extras .= "Content-Language: de\n";
// Betreff-Zeile festlegen
$mail_subject = "Fehler 404";
// Text der E-Mail zusammenstellen
$mail_text = "Aufgerufene Adresse: https://" . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"] . "\n";
$mail_text = "HTTP Referer: "
. ( isset( $_SERVER['HTTP_REFERER'] ) && $_SERVER['HTTP_REFERER'] )
? $_SERVER['HTTP_REFERER']
: 'not given'
. PHP_EOL . PHP_EOL;
$mail_text .= "Datum: " . date("j.n.Y H:i:s e") . "\n";
$mail_text .= "IP-Adresse: " . $_SERVER["REMOTE_ADDR"] . "\n";
$mail_text .= "User Agent: " . $_SERVER["HTTP_USER_AGENT"];
// E-Mail senden
@mail($mail_to, $mail_subject, $mail_text, $mail_extras);
?>