I have a simple script that is meant to send me an email with contact information when someone fills the form on my website. But no matter what email I enter, I always get the error message "Registration failed. Please send an email to XXXXX@gmail.com"
Anyone have any idea why I can't get the script to run correctly?
As a side note, for reference for anyone else having this problem, this is the register.php file include in the SumoThemes Bundle. Here's a link to a screenshot of the documentation.
Although this thread was useful none of the solutions presented fixed my problem.
<?php
$field_email = $_POST['email'];
$mail_to = 'XXXX@gmail.com';
$subject = '#Website Lead '.$field_email;
$body_message = 'From: '.$field_name."\n";
$body_message .= 'E-mail: '.$field_email."\n";
$headers = 'From: '.$E-Mail."\r\n";
$headers .= 'Reply-To: '.$E-Mail."\r\n";
$mail_status = mail($mail_to, $subject, $body_message, $headers);
if ($mail_status) { ?>
<script language="javascript" type="text/javascript">
alert('Thank you for your interest. We will get back to you ASAP.');
window.location = 'index.html';
</script>
<?php
}
else { ?>
<script language="javascript" type="text/javascript">
alert('Registration failed. Please send an email to XXXXX@gmail.com');
window.location = 'index.html';
</script>
<?php
}
?>