Jump to content

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


3ddream

Recommended Posts

hello there ,

 

I am trying to solve this problem i dont know why this happening

 

I have attached my form - this form works fine but only on that email my email lampros@3ddream.net

if i change it to a yahoo or gmail i never get an email back ?

 

 

 

 

 

[attachment deleted by admin]

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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: <info@yourdomain.com>\n";
    $headers.="Message-ID: <".time()."info@yourdomain.com>\n";
    $headers.="From: info@yourdomain.com\n";
    $headers.="Reply-To: info@yourdomain.com\n";

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

 

Replace info@yourdomain.com to your email address.

 

Link to comment
Share on other sites

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 = "lk_pa@yahoo.com";

$subject = "Form";

 

$name = $_POST['name'];

$email = $_POST['email'];

$company = $_POST['company'];

$message = $_POST['message'];

$headers  = "From: 3DDream.Net | Contact Form<noreply@3DDream.net> \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);

 

}

?>

 

 

Link to comment
Share on other sites

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 = "lk_pa@yahoo.com";

$subject = "UK Scrap Cars Form";

 

$name = $_POST['name'];

$email = $_POST['email'];

$company = $_POST['company'];

$message = $_POST['message'];

$headers  = "From: 3DDream.Net | Contact Form<noreply@3DDream.net> \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]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.