Jump to content

PHP contact form help..........


3ddream

Recommended Posts

You are not putting the $headers variable into the mail() function call, so your email either has no From: address or it is using the default From: address that is set in the php.ini. This limits who your sending mail server will send to and which receiving mail servers will accept the email.

 

Once you correct the code so that $headers is used in the mail() function call, it should work better.

Big chances that you can find your messages in the SPAM folder in your Gmail/Yahoo account. If putting headers (as suggested by PFMaBiSmAd)  not help - it is likely that your server's IP is blacklisted, and you'll need to investigate and resolve this with your hosting provider.

 

As for headers, here is how to do this:

 


    $headers ="MIME-Version: 1.0\n";
    $headers.="Content-type: text/html; charset=utf-8\n";
    $headers.="Content-transfer-encoding: 8Bit\n";
    $headers.="Return-Path: <[email protected]>\n";
    $headers.="Message-ID: <".time()."[email protected]>\n";
    $headers.="From: [email protected]\n";
    $headers.="Reply-To: [email protected]\n";

    if(!mail($to,$subject,$message,$headers)){
      return false;
    }
    else{
      return true;
    }

 

Replace [email protected] to your email address.

 

still i cannot make it work

 

what do i need to correct here

<?php

if(isset($_POST['submit'])) {

 

$response = "Thank you!";

$_POST['response'] = $response;

 

$to = "[email protected]";

$subject = "Form";

 

$name = $_POST['name'];

$email = $_POST['email'];

$company = $_POST['company'];

$message = $_POST['message'];

$headers  = "From: 3DDream.Net | Contact Form<[email protected]> \n";

$headers  .= "Reply-To: {$email}";

 

 

$error = false;

if(strlen($name) == 0) $error = "Empty name";

if(strlen($email) == 0) $error = "Empty email";

if(strlen($company) == 0) $error = "Empty company";

if(strlen($message) == 0) $error = "Empty message";

 

$body = "From: $name\n Email: $email\n Company: $company\n Message: $message\n";

 

if(!$error)

mail($to, $subject, $body);

 

}

?>

 

 

thanks sergey

 

i try that no luck ?????

 

i tried mail($to, $subject, $body, $headers);  and mail($to, $subject, $body, $header);

 

<?php

if(isset($_POST['submit'])) {

 

$response = "Thank you!";

$_POST['response'] = $response;

 

$to = "[email protected]";

$subject = "UK Scrap Cars Form";

 

$name = $_POST['name'];

$email = $_POST['email'];

$company = $_POST['company'];

$message = $_POST['message'];

$headers  = "From: 3DDream.Net | Contact Form<[email protected]> \n";

$headers  .= "Reply-To: {$email}";

 

 

$error = false;

if(strlen($name) == 0) $error = "Empty name";

if(strlen($email) == 0) $error = "Empty email";

if(strlen($company) == 0) $error = "Empty company";

if(strlen($message) == 0) $error = "Empty message";

 

$body = "From: $name\n Email: $email\n Company: $company\n Message: $message\n";

 

if(!$error)

mail($to, $subject, $body, $headers);

 

}

?>

 

i have attach the form

 

[attachment deleted by admin]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.