PHP code check for my forms

Discussion in 'PHP' started by buckmajor, Dec 2, 2009.

  1. #1
    Hi there

    I have been using this PHP code for some time now, and started to find something fishy when I notice that I stop receiving emails from my form. So I did test, filled out my form and realized that none of the forms has gone to my email addys. I only asked for your help, so I can find out if my PHP code is in error which has been a success for a few years now, or the actual server with the hosting company that I am with??

    Here is my code:

    <?php
    /* start email */
    $contents = "WEBSITE BRIEF STATEMENT"
    ."<br>----------------------------"
    ."<br>PROJECT"
    ."<br>----------------------------"
    ."<br>Project = ".$_POST['project']
    ."<br>----------------------------"
    ."<br>PERSONAL DETAILS"
    ."<br>----------------------------"
    ."<br>Name = ".$_POST['First']
    ."<br>Last = ".$_POST['Last']
    ."<br>Phone = ".$_POST['Phone']
    ."<br>Email = " .$_POST['Email']
    ."<br>----------------------------"

    $subject = "Title";
    $from = "Website Enquiry Form";
    $cont = True;
    $to = "email@address.com";
    $from_header = "From: $from \r\n";
    $from_header .= "Content-type: text/html; charset=iso-8859-1\r\n";

    if ($cont):
    mail($to, $subject, $contents, $from_header);
    endif;
    ?>

    If there is an error, than I know it would execute online, so I hoping its the server.

    Many thanks in advance
    CHEERS :)
     
    buckmajor, Dec 2, 2009 IP
  2. buckmajor

    buckmajor Active Member

    Messages:
    574
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #2
    Hi there

    I have been using this PHP code for some time now, and started to find something fishy when I notice that I stop receiving emails from my form. So I did test, filled out my form and realized that none of the forms has gone to my email addys. I only asked for your help, so I can find out if my PHP code is in error which has been a success for a few years now, or the actual server with the hosting company that I am with??

    Here is my code:

    <?php
    /* start email */
    $contents = "WEBSITE BRIEF STATEMENT"
    ."<br>----------------------------"
    ."<br>PROJECT"
    ."<br>----------------------------"
    ."<br>Project = ".$_POST['project']
    ."<br>----------------------------"
    ."<br>PERSONAL DETAILS"
    ."<br>----------------------------"
    ."<br>Name = ".$_POST['First']
    ."<br>Last = ".$_POST['Last']
    ."<br>Phone = ".$_POST['Phone']
    ."<br>Email = " .$_POST['Email']
    ."<br>----------------------------"
    
    $subject = "Title";
    $from = "Website Enquiry Form";
    $cont = True;
    $to = "email@address.com";
    $from_header = "From: $from \r\n";
    $from_header .= "Content-type: text/html; charset=iso-8859-1\r\n";
    
    if ($cont):
       mail($to, $subject, $contents, $from_header);
    endif;
    ?>
    
    Code (markup):
    If there is an error, then I know it would not execute online, so I'm hoping its the server.

    Many thanks in advance
    CHEERS :)
     
    buckmajor, Dec 2, 2009 IP
  3. ebookbusiness

    ebookbusiness Member

    Messages:
    41
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #3
    The code looks fine. There could be a problem with your hosting provider's mail server.
     
    ebookbusiness, Dec 3, 2009 IP
  4. sloddl

    sloddl Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    yep... the code looks ok... i would change:

    if ($cont):
    mail($to, $subject, $contents, $from_header);
    endif;

    to:

    if ($cont){
    mail($to, $subject, $contents, $from_header);
    }
     
    sloddl, Dec 3, 2009 IP
  5. buckmajor

    buckmajor Active Member

    Messages:
    574
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #5
    Hey guys

    Thanks for replying, I found out that it was the hosting provider's mail server as 'ebookbusiness' mentioned.

    Sweet then, so I just remove the endif; Thanks sloddl, I'll do that and go from there.

    CHEERS :)
     
    buckmajor, Dec 3, 2009 IP