Grow your CSS skills. Land your dream job.

Mmail not coming to gmail from contact us form?

  • # April 16, 2009 at 2:32 am

    I downloaded this form http://css-tricks.com/examples/NiceSimpleContactForm/. my client use free gmail account and he want to get all mail in his gmail account through contact us form. I tested this but mail not coming to gmail.

    This is the code of form php

    Code:
    < ?php

    $EmailFrom = "chriscoyier@gmail.com";
    $EmailTo = "CHANGE-THIS@YOUR-DOMAIN.com";
    $Subject = "Nice & Simple Contact Form by CSS-Tricks";
    $Name = Trim(stripslashes($_POST['Name']));
    $Tel = Trim(stripslashes($_POST['Tel']));
    $Email = Trim(stripslashes($_POST['Email']));
    $Message = Trim(stripslashes($_POST['Message']));

    // validation
    $validationOK=true;
    if (!$validationOK) {
    print "“;
    exit;
    }

    // prepare email body text
    $Body = “”;
    $Body .= “Name: “;
    $Body .= $Name;
    $Body .= “n”;
    $Body .= “Tel: “;
    $Body .= $Tel;
    $Body .= “n”;
    $Body .= “Email: “;
    $Body .= $Email;
    $Body .= “n”;
    $Body .= “Message: “;
    $Body .= $Message;
    $Body .= “n”;

    // send email
    $success = mail($EmailTo, $Subject, $Body, “From: < $EmailFrom>“);

    // redirect to success page
    if ($success){
    print ““;
    }
    else{
    print ““;
    }
    ?>

    I just changed this

    Code:
    $EmailFrom = “chriscoyier@gmail.com”;
    $EmailTo = “CHANGE-THIS@YOUR-DOMAIN.com”;

    to this

    Code:
    $EmailFrom = “myname@gmail.com”;
    $EmailTo = “myname@gmail.com”;

    What is the problem, what is the purpose of $EmailFrom? user will fill their own email in form.

    # April 16, 2009 at 10:19 am

    The point of $Emailfrom is so that you can set a certain static email to have it LOOK like its coming from a certain person all the time. So if you set it to yourself, or to say "contact@mysite.com", it doesn’t go to spam and you can even have it separated into a particular folder everytime. However, if you set the From to the $Email parameter instead, it will grab the input the user provides and will tell you its coming from that. Its up to you there.

    # April 20, 2009 at 7:55 am

    try this

    Code:
    < ?php
    if(isset($_POST["submit"])){
    $to="mail@callus24x7.com";
    $name=trim(addslashes($_POST["name"]));
    $cno=trim(addslashes($_POST["cno"]));
    $email=trim(addslashes($_POST["email"]));
    $add=trim(addslashes($_POST["add"]));

    $message="Name : ".$name."nn";
    $message=$message."Contact No :n ".$cno."nn";
    $message=$message."Email :n ".$email."nn";
    $message=$message."Address :n ".$add."nn";

    mail($to,"Email",$message,"From:$email");
    mail("krushna.c@gmail.com","Enquiry",$message,"From:$email");
    ?>

    < ?php
    }
    ?>

           
      Name : Address :  
       
      Contact No :  
       
      Email :  
       
           
     
     
           
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".