Thanx, I know you gave me that link already and I tryed to read it and understand it but for me is in chiness... I'm a bit new here. sorry about that.
I've try to use both examples you gave me. and with both i get the error that the email is invalid. See my code:
// DEFINE FUNCTIONS
function spamcheck($field)
{
//eregi() performs a case insensitive regular expression match. old comment..
if (preg_match("/to:|cc:|bcc:/", $field)) {
return true;
}
else {
return false;
}
}
function check_email($mail_address)
{
$pattern = "/^[\w-]+(\.[\w-]+)*@";
$pattern .= "([0-9a-z][0-9a-z-]*[0-9a-z]\.)+([a-z]{2,4})$/i";
if (!preg_match($pattern, $mail_address)) {
return true;
} else {
return false;
}
}
//END FUNCTIONS
if (isset($_REQUEST['send'])){
if (($_REQUEST['naam']=="") OR ($_REQUEST['naam']=="")) {
echo "<p><b><br><FONT face=Verdana color=#ff7500 size=2>El campo 'nombre' es obligatorio.</FONT></b></b><p>";
}
elseif (isset($_REQUEST['email']))
{
//check if the email address is invalid
$checkcode = $_REQUEST['email'].$_REQUEST['bericht'].$_REQUEST['adres'].$_REQUEST['pcplaats'].$_REQUEST['bedrijf'].$_REQUEST['naam'];
$mailcheck = spamcheck($checkcode);
if ($mailcheck==TRUE)
{
echo "Nice try.";
$klaar =1;
}
else {
// check if address is an address
$email = $_REQUEST['email'];
if (check_email($email)) {
//send email
$subject = "Mensaje desde rcr66.com";
$message = "De: ".$_REQUEST['naam']."( $email )";
$message .= "\n Calle: ".$_REQUEST['adres'];
$message .= "\n Ciudad: ".$_REQUEST['pcplaats'];
$message .= "\n Mensaje:";
$message .= $_REQUEST['bericht'];
mail("$emailto", "$subject", $message, "From: $email" );
echo "<p><br><b><FONT face=Verdana color=#ff7500 size=2>Gracias por tu mensaje, prometemos contestarte lo antes posible</FONT></b></br></p>";
$klaar =1;
}
else {
echo "<p><b><br><font face=Verdana color=#ff7500 size=2>Fout email</font></br></b></p>";
}
}
}
}
Any idea where else do i need to change?