Form working, yet email isn't received?

Discussion in 'PHP' started by Heyzoos, Jun 5, 2008.

  1. #1
    Hi,

    I've had the following form working great on a website and it would send the email with the data. A couple of days ago however, the form still accepts the information and goes to the 'thank you' page, yet now the email isn't coming through... Any ideas?

    I've tried using different email addresses from different servers and have also tried testing the following, but no luck:

    <?php

    mail('email@domain.com', 'test', 'test');

    ?>

    Here's the code I'm using for the pages:

    On the form page:

    <form action="process.php" method="POST">

    On the 'process' page:

    <?php
    include("global.inc.php");
    $errors=0;
    $error="The following errors occured while processing your form input.<ul>";
    pt_register('POST','name');
    pt_register('POST','email');
    pt_register('POST','S1');
    pt_register('POST','Tour1');
    pt_register('POST','T1');
    pt_register('POST','Adults1');
    pt_register('POST','FirstName');
    pt_register('POST','SecondName');
    pt_register('POST','Children1');
    pt_register('POST','Children2');
    pt_register('POST','Departure1');
    pt_register('POST','Tour2');
    pt_register('POST','T2');
    pt_register('POST','Adults2');
    pt_register('POST','FirstName2');
    pt_register('POST','SecondName2');
    pt_register('POST','Children21');
    pt_register('POST','Children22');
    pt_register('POST','Departure2');
    pt_register('POST','Comments');
    pt_register('POST','Cardtype');
    pt_register('POST','Cardname');
    pt_register('POST','Carddate');
    pt_register('POST','Cardnumber');
    pt_register('POST','Howfound');
    if($email=="" ){
    $errors=1;
    $error.="<li>Please fill in your email address.";
    }
    if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$email)){
    $error.="<li>Invalid email address entered";
    $errors=1;
    }
    if($errors==1) echo $error;
    else{
    $where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));
    $message="Name: ".$name."
    Email: ".$email."
    Pickup Address and Phone Number: ".$S1."
    1st Tour: ".$Tour1."
    Options: ".$T1."
    Number of Adults: ".$Adults1."
    Name of 1st Adult: ".$FirstName."
    Name of 2nd Adult: ".$SecondName."
    Number of Children: ".$Children1."
    Names and Ages: ".$Children2."
    Departure Date: ".$Departure1."
    2nd Tour: ".$Tour2."
    Options: ".$T2."
    Number of Adults: ".$Adults2."
    Name of 1st Adult: ".$FirstName2."
    Name of 2nd Adult: ".$SecondName2."
    Number of Children: ".$Children21."
    Names and Ages: ".$Children22."
    Departure Date: ".$Departure2."
    Comments: ".$Comments."
    Credit Cart Type: ".$Cardtype."
    Card Holder Name: ".$Cardname."
    Expiry Date: ".$Carddate."
    Card Number: ".$Cardnumber."
    How they found the website: ".$Howfound."
    ";
    $message = stripslashes($message);
    mail("sales@mydomain.com","New Booking!",$message,"From: Online Booking Received");

    header("Refresh: 0;url=http://www.mydomain.com/thanks.html");
    ?><?php
    }
    ?>


    On the 'global' page:

    <?php

    function pt_register()
    {
    $num_args = func_num_args();
    $vars = array();

    if ($num_args >= 2) {
    $method = strtoupper(func_get_arg(0));

    if (($method != 'SESSION') && ($method != 'GET') && ($method != 'POST') && ($method != 'SERVER') && ($method != 'COOKIE') && ($method != 'ENV')) {
    die('The first argument of pt_register must be one of the following: GET, POST, SESSION, SERVER, COOKIE, or ENV');
    }

    $varname = "HTTP_{$method}_VARS";
    global ${$varname};

    for ($i = 1; $i < $num_args; $i++) {
    $parameter = func_get_arg($i);

    if (isset(${$varname}[$parameter])) {
    global $$parameter;
    $$parameter = ${$varname}[$parameter];
    }

    }

    } else {
    die('You must specify at least two arguments');
    }

    }

    ?>
    :confused:
     
    Heyzoos, Jun 5, 2008 IP
  2. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #2
    Try to make real headers like the examples on php.net/mail
     
    EricBruggema, Jun 6, 2008 IP