Hi! Why it's doesn't work?When i refresh page, website automatically send again and again same empty email. I know how can i fix it,but it doesn't work now, and idk why.
<?php
$to = 'email@email.hu';
$from = $_POST['email'];
$subject = "XXXXXXX";
$name= $_POST['name'];
//
$htmlContent = '
<html>
<body>
<center>
<table rules="all" style="border-color: #666;" cellpadding="10" width="40% text-align: center;">
<tr style="background-color: #43464b; color: white;"><td><strong>name:</strong> </td></td>' . $name. '</td></tr>
</table>
</center>
</body>
</html>';
// Set content-type header for sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
// Additional headers
$headers .= 'From: Webnév<web@web.hu>' . "\r\n";
$headers .= 'Cc: welcome@example.com' . "\r\n";
$headers .= 'Bcc: welcome2@example.com' . "\r\n";
// Send email
if(mail($to,$subject,$htmlContent,$headers)):
header("Location: " . $_SERVER['REQUEST_URI'] . "?");
?>