Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End A nice & Simple contact form no email being sent

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #31245
    marklandry
    Member

    HI,
    I have A Nice & Simple form on my site – it’s great and works fine when I use it from my machine, but doesn’t work when my client uses it from his machine ie, we can both view and fill out the form, but the email is set to go to him and won’t work for him. Does that make sense?

    I’ve got everything setup similar to the original files, except that the recapchalib.php and contactengine.php are in the root, while the form.html is in a sub-folder – that’s the only way I could get it to work

    Can anyone suggest why this might work flawlessly on one machine and not another?

    Also, just did some more testing – it won’t send to my yahoo account – at least now I can replicate a problem…

    Thanx again.

    Mark

    #65967

    Hey Mark, do you have any code to share or a live example that we can dig into? From the information I have so far, there could be a hundred different problems.

    #66014
    marklandry
    Member

    Thanx Aaron,
    Yes – one of the forms is Here

    Here’s my form code:






    Staffing Needs Request



    Use this form to tell us about your staffing needs. Let us know who you are, how best to contact you, and what positions you are looking to fill.



    After entering your information, click "Submit" to submit your request to us. Upon receipt, one of our specialists will review your requirements and contact you.









































































    require_once('recaptchalib.php');
    $publickey = "6Lc_a8ASAAAAAL82B-WGG1gRXF7iL4V118Glw-h5";
    $privatekey = "6Lc_a8ASAAAAAL_yyeFiFgOFsJ62ksMUGdlkyu4A";

    # the response from reCAPTCHA
    $resp = null;
    # the error code from reCAPTCHA, if any
    $error = null;

    # are we submitting the page?
    if ($_POST["submit"]) {
    $resp = recaptcha_check_answer ($privatekey,
    $_SERVER["REMOTE_ADDR"],
    $_POST["recaptcha_challenge_field"],
    $_POST["recaptcha_response_field"]);

    if ($resp->is_valid) {
    echo "You got it!";
    # in a real application, you should send an email, create an account, etc
    } else {
    # set the error code so that we can display it. You could also use
    # die ("reCAPTCHA failed"), but using the error message is
    # more user friendly
    $error = $resp->error;
    }
    }
    echo recaptcha_get_html($publickey, $error);
    ?>








    Sorry it’s so long but thanx again for the help.

    Mark

    #65897
    marklandry
    Member

    Here’s my version of the contactengine.php code:

    
    
    require_once('recaptchalib.php');
    $privatekey = "6Lc_a8ASAAAAAL_yyeFiFgOFsJ62ksMUGdlkyu4A ";
    $resp = recaptcha_check_answer ($privatekey,
    $_SERVER["REMOTE_ADDR"],
    $_POST["recaptcha_challenge_field"],
    $_POST["recaptcha_response_field"]);

    if (!$resp->is_valid) {
    die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
    "(reCAPTCHA said: " . $resp->error . ")");
    }

    ini_set("sendmail_from", "[email protected]");

    $EmailFrom = "[email protected]";
    $EmailTo = "[email protected]";
    $Subject = "Staffing Needs Request Form";
    $Name = Trim(stripslashes($_POST));
    $Title = Trim(stripslashes($_POST));
    $Facility = Trim(stripslashes($_POST));
    $Address = Trim(stripslashes($_POST));
    $City = Trim(stripslashes($_POST));
    $State = Trim(stripslashes($_POST));
    $Zip = Trim(stripslashes($_POST));
    $Phone = Trim(stripslashes($_POST));
    $Fax = Trim(stripslashes($_POST));
    $Email = Trim(stripslashes($_POST));
    $PosTitle = Trim(stripslashes($_POST));
    $Location = Trim(stripslashes($_POST));
    $Salary = Trim(stripslashes($_POST));
    $BJD = Trim(stripslashes($_POST));
    $Comments = Trim(stripslashes($_POST));

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

    // prepare email body text
    $Body = "";
    $Body .= "Name: ";
    $Body .= $Name;
    $Body .= "n";
    $Body .= "Title: ";
    $Body .= $Title;
    $Body .= "n";
    $Body .= "Facility: ";
    $Body .= $Facility;
    $Body .= "n";
    $Body .= "Address: ";
    $Body .= $Address;
    $Body .= "n";
    $Body .= "City: ";
    $Body .= $City;
    $Body .= "n";
    $Body .= "State: ";
    $Body .= $State;
    $Body .= "n";
    $Body .= "Zip Code: ";
    $Body .= $Zip;
    $Body .= "n";
    $Body .= "Phone Number: ";
    $Body .= $Phone;
    $Body .= "n";
    $Body .= "Fax: ";
    $Body .= $Fax;
    $Body .= "n";
    $Body .= "Email: ";
    $Body .= $Email;
    $Body .= "n";
    $Body .= "Title of Position: ";
    $Body .= $PosTitle;
    $Body .= "n";
    $Body .= "Location: ";
    $Body .= $Location;
    $Body .= "n";
    $Body .= "Salary: ";
    $Body .= $Salary;
    $Body .= "n";
    $Body .= "Basic Job Description: ";
    $Body .= $BJD;
    $Body .= "n";
    $Body .= "Comments: ";
    $Body .= $Comments;
    $Body .= "n";




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

    // redirect to success page
    if ($success){
    print "";
    }
    else{
    print "";
    }
    ?>
Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘Back End’ is closed to new topics and replies.