//this pgm will send a mail to site administrator
//author:thomas p
//email:tom_tom@mail.com
if($submit==".: submit :.")
{
//initializing $error to 0
$error=0;
//all validations are done here.
//if there is any error we set $error to 1
$errormsg="Invalid entries have been detected. Please check the following
";
$name=trim(stripslashes($name));
$company=trim(stripslashes($company));
$email=trim($email);
$place=trim(stripslashes($place));
$message=trim(stripslashes($message));
if(!trim($name))
{
//if name is blank
$error=1;
$errormsg.=".:: :: Please enter your name :: :.
";
}
if(!eregi( "^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,4}$",$email))
{
$error=1;
$errormsg.=".: :: Invalid email :: :.
";
}
if($error==0)
{
$body ="Name________________________$name\n";
if(trim($company))
{
$body.="Organization__________________$company\n";
}
$body.="Email________________________$email\n";
if(trim($place))
{
$body.="Place________________________$place\n";
}
if(trim($message))
{
$body.="Message_____________________$message\n";
}
$mailid="info@linkswithchina.com";
$from="From: ".$name;
mail($mailid,"Enquiry from CAL Homepage",$body,$from);
//sending a confirmation mail to user
$from="From: info@creativeartslab.com";
$body="Thank you for your query. We will come back to you soon";
mail($email,"Thank you for your enquiry",$body,$from);
$error=2;
}
}
?>