0

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
}
?>
brick
  • 1
  • 1
  • 1
    documentation link is a local file system link. Where are you running this script? local or on a server? Is there a smtp server setup? – John Feb 10 '18 at 19:52
  • Look like $E-Mail contain no value. – Shahnawaz Kadari Feb 10 '18 at 20:08
  • Thanks for noticing that - I replaced the link to my local file to a screenshot. I got it live on heroku. And there is no smtp server setup... – brick Feb 10 '18 at 23:40

0 Answers0