I have a problem with my post.php script. If I use it online, and I post a something with that script, it says that my message has been sended succesfully. But, I never receive the message on my email... is this because php mail() isn't supported or something? Here is my php script, may be I made some mistakes?
CODE
<?php
$yoursite = "http://jjwd.uuuq.com/"; // Jouw site-naam en/of url
$recieve_email = "noreply@lakitna.nl"; // email adres waar de email naar toe word verstuurd (ontvanger)
// Function validate runs all of the checks like empty fields.
function validate()
{
// if fist name is empty: throw error
if (empty($_POST['name_first'])) { $r.= "Vul uw naam in.<br />"; }
// if email is empty: throw error
if (empty($_POST['email'])) { $r.= "Vul uw email adres in.<br />"; }
else
{
// if email is not a correct email adress: throw error
if (preg_match('/.*@.*\..*/', $_POST['email']) > 0) {}
else { $r.= "Vul een geldig email adres in.<br />"; }
}
// if subject is empty: throw error
if (empty($_POST['subject'])) { $r.= "U heeft geen onderwerp ingevoerd.<br />"; }
// if message is empty: throw error
if (empty($_POST['message'])) { $r.= "U heeft geen bericht ingevoerd.<br />"; }
return $r;
}
$result = validate();
// if the submit button is clicked
if ($_POST['submit'])
{
// if the function validate is empty (everything is correct)
if ( empty($result) )
{
// mail content
$mail = "Via het contact formulier op ".$yoursite." is door ".$_POST['name_first']." ".$_POST['name_last']." het volgende bericht gestuurd.";
$mail.= "\n\n"."Onderwerp:"."\n".$_POST['subject'];
$mail.= "\n\n"."Bericht:"."\n".$_POST['message'];
$mail.= "\n\n"."Contact email:"."\n".$_POST['email'];
// mail subject
$mail_subject = $yoursite." - ".$_POST['subject'];
// mail headers
$headers = 'From: Contact form <'.$_POST['email'].'>'."\r\n";
// send the mail
mail($recieve_email, $mail_subject , $mail , $headers);
// succes message
echo "<fieldset>Email is succesvol verstuurd.</fieldset>";
}
// if the function validat is not empty (there is a error)
else
{
// display the errors
echo "<fieldset>".$result."</fieldset>";
}
}
?>
$yoursite = "http://jjwd.uuuq.com/"; // Jouw site-naam en/of url
$recieve_email = "noreply@lakitna.nl"; // email adres waar de email naar toe word verstuurd (ontvanger)
// Function validate runs all of the checks like empty fields.
function validate()
{
// if fist name is empty: throw error
if (empty($_POST['name_first'])) { $r.= "Vul uw naam in.<br />"; }
// if email is empty: throw error
if (empty($_POST['email'])) { $r.= "Vul uw email adres in.<br />"; }
else
{
// if email is not a correct email adress: throw error
if (preg_match('/.*@.*\..*/', $_POST['email']) > 0) {}
else { $r.= "Vul een geldig email adres in.<br />"; }
}
// if subject is empty: throw error
if (empty($_POST['subject'])) { $r.= "U heeft geen onderwerp ingevoerd.<br />"; }
// if message is empty: throw error
if (empty($_POST['message'])) { $r.= "U heeft geen bericht ingevoerd.<br />"; }
return $r;
}
$result = validate();
// if the submit button is clicked
if ($_POST['submit'])
{
// if the function validate is empty (everything is correct)
if ( empty($result) )
{
// mail content
$mail = "Via het contact formulier op ".$yoursite." is door ".$_POST['name_first']." ".$_POST['name_last']." het volgende bericht gestuurd.";
$mail.= "\n\n"."Onderwerp:"."\n".$_POST['subject'];
$mail.= "\n\n"."Bericht:"."\n".$_POST['message'];
$mail.= "\n\n"."Contact email:"."\n".$_POST['email'];
// mail subject
$mail_subject = $yoursite." - ".$_POST['subject'];
// mail headers
$headers = 'From: Contact form <'.$_POST['email'].'>'."\r\n";
// send the mail
mail($recieve_email, $mail_subject , $mail , $headers);
// succes message
echo "<fieldset>Email is succesvol verstuurd.</fieldset>";
}
// if the function validat is not empty (there is a error)
else
{
// display the errors
echo "<fieldset>".$result."</fieldset>";
}
}
?>
Thx for the assistance!
