I am having problems getting my contact.php form to work. Before I was not getting the message to my email at all, now, the email does get sent, always show me:
"Message failed. Please, send an email to treneree@gmail.com" this is all it shows:
Form:
<form action="contact.php" method="post" class="tm-contact-form">
<div class="form-group">
<input name=”cf_name” type="text" id="contact_name" class="form-control" placeholder="NAME..." />
</div>
<div class="form-group">
<input name=”cf_email” type="text" id="contact_email" class="form-control" placeholder="EMAIL..." />
</div>
<div class="form-group">
<textarea name=”cf_message” id="contact_message" class="form-control" rows="8" placeholder="WRITE A MESSAGE..."></textarea>
</div>
<button type="submit" class="btn text-uppercase tm-dark-bg tm-orange-text tm-send-btn">Send</button>
</form>
and php:
<?php
$field_name = $_POST['cf_name'];
$field_email = $_POST['cf_email'];
$field_message = $_POST['cf_message'];
$mail_to = 'trener.waw@gmail.com' ;
$subject = 'Message from a site visitor '.$field_name;
$body_message = 'From: '.$field_name."\n";
$body_message .= 'E-mail: '.$field_email."\n";
$body_message .= 'Message: '.$field_message;
$headers = 'From: '.$field_email."\r\n";
$headers .= 'Reply-To: '.$field_email."\r\n";
$mail_status = mail($mail_to, $subject, $body_message, $headers);
if ($mail_status) { ?>
<script language="javascript" type="text/javascript">
alert('Thank you for the message. We will contact you shortly.');
window.location = 'index.html';
</script>
<?php
}
else { ?>
<script language="javascript" type="text/javascript">
alert('Message failed. Please, send an email to treneree@gmail.com');
window.location = 'index.html';
</script>
<?php
}
?>
Anyone?