I've developed an iOS app and rails backend server. While I took some HTML classes back in university, it's been a long while since I've touched any.
I purchased a 'template' website to be my application landing page. I've tweaked it to be what I want, but I'm having 1 issue with the Contact/Form Submission page. When I press send, I do not receive an email at the intended email address. I'm not sure if this is an issue with the code (I'm guessing not, I would think this highly rated template would have had something like this correct), or if I need to set up something with my domain that I currently haven't done as I wouldn't know about it.
Here's the relevant code...
index.html
<form action="javascript:;" method="post">
...
<input type="submit" class="button white" value="Send →" />
</form>
send_email.php
<?php
// Replace this with your own email address
$to="example@gmail.com";
// Extract form contents
$name = $_POST['name'];
$email = $_POST['email'];
$website = $_POST['website'];
$subject = $_POST['subject'];
$message = $_POST['message'];
// Validate email address
function valid_email($str) {
return ( ! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $str)) ? FALSE : TRUE;
}
// Return errors if present
$errors = "";
if($name =='') { $errors .= "name,"; }
if(valid_email($email)==FALSE) { $errors .= "email,"; }
if($message =='') { $errors .= "message,"; }
// Send email
if($errors =='') {
$headers = 'From: FluidApp <no-reply@fluidapp.com>'. "\r\n" .
'Reply-To: '.$email.'' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
$email_subject = "Website Contact Form: $email";
$message="Name: $name \n\nEmail: $email \n\nWebsite: $website \n\nSubject: $subject \n\nMessage:\n\n $message";
mail($to, $email_subject, $message, $headers);
echo "true";
} else {
echo $errors;
}
?>
However, nothing is being sent to my email "example@gmail.com".
What might I be missing here?