Hi, I am having trouble getting my form mailer to work. The form itself works, and it redirects to a thank you page, but I cannot seem to receive the email notifications in my inbox. I’ve checked all spam settings, etc. The HTML form code is:
First Name: Last Name:Email: Date:
Question/Concern:
and the PHP handler code is:
<?php if (isset($_POST['send'])) { $to = '[email protected]'; $subject = "New message from $name"; $message = "First Name: " . $_POST['name'] . "\r\n\r\n"; $message .= "Last Name: " . $_POST['surname'] . "\r\n\r\n"; $message .= "Email: " . $_POST['email'] . "\r\n\r\n"; $message .= "Date: " . $_POST['date'] . "\r\n\r\n"; $message .= "Message: " . $_POST['text']; $message = wordwrap($text, 70); $headers = "From: [email protected]\r\n"; $headers .= 'Content-Type: text/plain; charset=utf-8'; $email = filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL); if ($email) { $headers .= "\r\nReply-To: $email"; } $success = mail($to, $subject, $body, $headers, '[email protected]'); } ?><?php if (isset($success) && $success) { ?>
<h1>Thank you, <?php $name.\n ?>!</h1>
<p3>Your message has been sent, and someone will get back to you shortly.</p3>
<?php } else { ?>
<h1>Oops!</h1>
<p3>There was a problem sending your message.</p3>
<?php } ?>
Can anyone help me, please!?