Results 1 to 3 of 3

Thread: mail() function in php

  1. #1
    Join Date
    Dec 2004
    Location
    Colorado USA
    Posts
    11

    Default mail() function in php

    im having problems with the mail() function
    here is the code that im using:
    Code:
    <html>
    <body>
    <table border="0" width=60% align="center">
    <tr>
    <td>
    <form method="POST" action="mail.php">
    Subject: <input type="text" name="subject">
    
    Your Email: <input type="text" name="email">
    
    Content:
    
    <textarea rows=20 cols=50 name="content">
    </textarea>
    
    <input type="submit" value="Send mail">
    </form>
    </td>
    </tr>
    </table>
    </body>
    </html>
    Code:
    <html>
    <body>
    <?php
    $subject=$_POST["subject"];
    $email=$_POST["email"];
    $content=$_POST["content"];
    $message="From: ".$email."\r\n".$content;
    if(mail("[email protected]", $subject, $message)===FALSE)
     echo "Mail failed.";
    else
     echo "Mail succeeded.";
    ?>
    </body>
    </html>
    when i push the 'Send email' button, nothing happens. The page doesnt load, and i dont get an email.

    what is wrong?

  2. #2
    Join Date
    Jan 2005
    Posts
    117

    Default

    Guess the server doesnt support mail() function. Try a smpt mail server.

  3. #3
    Join Date
    Jan 2005
    Posts
    95

    Default

    use
    <?
    mail($email, $subject, $body, $from);
    ?>

    it works

Bookmarks

Posting Permissions

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