File: /home/slyfwmm/incastiglionfiorentino/wp-content/themes/amplify/sendmail.php
<?php
//validate fields
$errors = '';
//has the form's submit button been pressed?
if( !empty( $_POST['myformsubmit'] ) )
{
// HAS THE SPAM TRAP FIELD BEEN FILLED IN?
if( !empty( $_POST['favouriteColour'] ) )
{
exit;
}
if(empty($_POST['name']) ||
empty($_POST['email']) ||
empty($_POST['message']) ||
empty($_POST['myemail']))
{
$errors .= "\n Error: all fields are required";
}
$myemail = $_POST['myemail'];
/*$myemail = 'press@incastiglionfiorentino.com';*/ //<-----Put Your email address here.
$name = $_POST['name'];
$email_address = $_POST['email'];
$message = $_POST['message'];
if (!eregi(
"^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$",
$email_address))
{
$errors .= "\n Error: Invalid email address";
}
//send email
if( empty($errors))
{
$to = $myemail;
$email_subject = "Richiesta Informazioni InCastiglionFiorentino.com da: $name";
$email_body = "Hai ricevuto un messaggio dal sito InCastiglionFiorentino.com".
" Di seguito i dettagli del messaggio:\n Nome: $name \n ".
"Email: $email_address\n Messaggio: \n $message";
$headers = "From: $email_address";
mail($to,$email_subject,$email_body,$headers);
//redirect to the 'thank you' page
}
else {
}
}
?>