0

Since PHP Version 7.4 i have a problem with my old Contact Form. It doesn't send the Content per Mail. There are no error-messages when i submit the form. Nothing comes to the inbox.

Can anybody help me with a quick and uncomplicated solution to make it work with 7.4?

I don't want to use PHPMAiler.

Thank You very much!

<?php 
$Empfaenger = "mail@domain.com";



$headers .= "Content-Type: text/plain; charset = \"UTF-8\";\n";
$headers .= "Content-Transfer-Encoding: 8bit\n";
$headers .= "\n";

if($_POST['Send'])
{
if(empty($_POST['content1']) || empty($_POST['content2']) || empty($_POST['content3']) || empty($_POST['content4']) || empty($_POST['content5']) || empty($_POST['Datenschutz']))   
{
echo"<div style='border-left: 7px solid #E94E1B; padding-left: 10px; margin-top: 40px; margin-bottom: 60px; border-radius: 1px; color: #000;'><p><b>Eorror</b></p></div>";
}
else
{
$Mailnachricht = "Mailform \n\n";
foreach ($_POST as $Formularfeld => $Wert)
{
if($Formularfeld!="Send")
{
$Mailnachricht .= $Formularfeld.": ".$Wert."\n";
}
}
$Mailnachricht .= "\nDatum/Zeit: ";
$Mailnachricht .= date("d.m.Y H:i:s");
$Mailbetreff = "Anfrage ".$_POST['FField']."";
$Mailbetreff .= $_POST['Emailadresse'];
mail($Empfaenger, $Mailbetreff, $Mailnachricht, "From: ".$_POST['Emailadresse']);
echo"<div style='border-left: 7px solid #34F27D; padding-left: 10px; margin-top: 40px; margin-bottom: 60px; border-radius: 1px; color: #000;'><p><b>Ihre Anfrage konnte erfolgreich versendet werden.</b></p>Text</div>";
}
}
?>
Alex
  • 3
  • 4
  • Consider switching to [PHPMailer](https://github.com/PHPMailer/PHPMailer). You'll need to debug the actual SMTP connection if there's no PHP errors. – Machavity Oct 06 '21 at 12:15
  • i don't want to use PHP Mailer. Is there no solution with my PHP script? – Alex Oct 06 '21 at 12:25
  • Read the duplicate question. It details how to debug `mail()`. Be prepared to spelunk through the fun world of Sendmail to find your error, tho. – Machavity Oct 06 '21 at 12:26

0 Answers0