View Single Post
  #24  
Old 10th July 2008, 16:23
ataman79 ataman79 is offline
Junior Member
 
Join Date: Aug 2007
Posts: 25
Thanks: 4
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by falko View Post
Did you specify a recipient in the mail command?

Yes I did, here is the script I'm using

PHP Code:
<?
/* Edit these preferences to suit your needs */

  
$mailto 'myemailaddress@domain.com'// insert the email address you want the form sent to
    
$returnpage 'thankyou.php'// insert the name of the page/location you want the user to be returned to
    
$sitename 'Anatoly-art'// insert the site name here, it will appear in the subject of your email

/* Do not edit below this line unless you know what you're doing */
    
  
$name $_POST['name'];
  
$tel $_POST['tel'];
  
$email $_POST['email'] ;
  
$enquiry stripslashes($_POST['query']);

    if (!
$name) {
        
open("<strong>Error:</strong> Please provide your name.<br/><br/><a href='javascript:history.go(-1)'>Back</a>");
         exit;
    }
    if (!
$tel) {
        print(
"<strong>Error:</strong> Please provide your telephone number.<br/><br/><a href='javascript:history.go(-1)'>Back</a>");
         exit;
    }
    if (!
eregi("[0-9]{5,25}"$tel)){
    print(
"<strong>Error:</strong> Telephone number must include: country code + area code + telephone number<br/><br/><a href='javascript:history.go(-1)'>Back</a>");
         exit;
    }
    if (!
$email) {
        print(
"<strong>Error:</strong> Please provide a valid email address.<br/><br/><a href='javascript:history.go(-1)'>Back</a>");
         exit;
    }
    if (!
$enquiry) {
        print(
"<strong>Error:</strong> Please provide your enquiry details.<br/><br/><a href='javascript:history.go(-1)'>Back</a>");
         exit;
    }
    if (!
eregi("^[a-z0-9]+([-_\.]?[a-z0-9])+@[a-z0-9]+([-_\.]?[a-z0-9])+\.[a-z]{2,4}"$email)){
    print(
"<strong>Error:</strong> this email address is not in a valid format.<br/><br/><a href='javascript:history.go(-1)'>Back</a>");
         exit;
    }    

  
$message "\n$name submitted the following message:\n\n$enquiry\n\nTheir contact details are as follows:\n\nName: $name\nTelephone: $tel\nEmail Address: $email\n";

  
mail($mailto"$sitename Contact Form from $name"$message"From: $email");
    
header("Location: " $returnpage);
?>
Reply With Quote