#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2013
    Posts
    2
    Rep Power
    0

    Contact form not sending emails


    Hello all,
    This is my first thread in this forum, I hope you could help me in this thread.

    I've created a contact form for my website, I'm using php, html and css
    php is used for the contact form engine that sends the mail,

    Here is my code:

    HTML:

    <div id="sss">
    <form method="post" action="contactengine.php">
    <input type="text" id="name">
    <input type="text" id="emailad">
    <textarea name="message" id="message" cols="30" rows="10">
    <input type="submit" class="send" value="Send" />
    </form>
    </div>
    </div>

    PHP:

    <?php
    $EmailTo = "My email";
    $Subject = "Message Sent";
    $Name = Trim(stripslashes($_POST['Name']));
    $Email = Trim(stripslashes($_POST['Email']));
    $Message = Trim(stripslashes($_POST['Message']));
    // validation
    $validationOK=true;
    if (!$validationOK) {
    print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
    exit;
    }
    // prepare email body text
    $Body = "";
    $Body .= "Name: ";
    $Body .= $Name;
    $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 "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.html\">";
    }
    else{
    print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
    }
    ?>

    the contact thanks page is displayed by no email received

    Thanks all
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2013
    Posts
    2
    Rep Power
    0
    it was a name property missing in input, problem solved
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2013
    Posts
    1
    Rep Power
    0
    Originally Posted by johnsmith.892
    it was a name property missing in input, problem solved
    nice.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    50
    Rep Power
    2
    Why not an heredoc instead of all those concatenating assignment operators?
    Last edited by freak.inside; September 19th, 2013 at 05:57 AM.
    All generalizations are false, including this one. Free hosting

IMN logo majestic logo threadwatch logo seochat tools logo