Hello, I'm pretty new to PHP and don't know much at the moment. I changed the contact form and ran into some problems with mail being sent directly to the trash.
I assume this is due to the fact that (unknown sender) continues to appear in the email header. I would appreciate if someone could help me fix this. Below is the code that I have embedded on the website:
<?php $name = $_POST['name']; $email = $_POST['email']; $message = $_POST['message']; $from = 'From: Wirral PT Enquiry'; $to = ' joebloggs@hotmail.com '; $subject = 'Wirral PT Enquiry'; $human = $_POST['human']; $headers = " enquiry@wirralpt.co.uk "; $body = "From: $name\n E-Mail: $email\n Message:\n $message"; if ($_POST['submit']) { if ($name != '' && $email != '') { if ($human == '2') { if (mail ($to, $subject, $body, $from)) { echo '<p>Your message has been sent!</p>'; } else { echo '<p>Something went wrong, go back and try again!</p>'; } } else if ($_POST['submit'] && $human != '4') { echo '<p> 1+1=2!! </p>'; } } else { echo '<p>You need to fill everything!!</p>'; } } ?>
source share