• home
  • forum
  • my
  • kt
  • download
  • PHP Automated Email

    Author: 2009-03-08 12:27:44 From:

    First, we need a new html page preferably called "form.html". Add the following code:

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

    Email
    <input type="text" name="email" size="19">
    <input type="submit" value="Submit" name="submit">
    </form>

    Now that we have that, we go on to php.

    Add this code to "Mailer.php" in the same direcorty:

    <?php
    if(isset($_POST['submit'])) {

    $ip=$_SERVER['REMOTE_ADDR'];
    $email_field = $_POST['email'];
    $subjecte = "Testr";
    $bodye = "Hello, $name-field!\n You should have $coin_field in your club penguin account";

    $body = "THIS IS THE MESSAGE HERE ";

    echo "An email has been sent to $email_field.";
    mail($email_field, $subjecte, $bodye);
    } else {

    echo "HEY! You refreshed the page, didn't you? Well, YOU CAN'T DO THAT. Whenever you refresh me, YOU BRAINWjavascript:validForm('save');
    SaveASH ME!!";

    }
    ?>

    But, all this does is send an email saying "Your Message Here".

    We want some dynamic stuff in the email, right?

    Edit the form html file to:

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

    Name
    <input type="text" name="name" size="19">

    Email
    <input type="text" name="email" size="19">
    <input type="submit" value="Submit" name="submit">
    </form>

    And the mailer.php to:

    <?php
    if(isset($_POST['submit'])) {

    $ip=$_SERVER['REMOTE_ADDR'];
    $email_field = $_POST['email'];
    $subjecte = "Test";

    $name = $_post['name'];

    $body = "Hello $name, \n your message here ";

    echo "An email has been sent to $email_field.";
    mail($email, $subjecte, $body);
    } else {

    echo "HEY! You refreshed the page, didn't you? Well, YOU CAN'T DO THAT. Whenever you refresh me, YOU BRAINWjavascript:validForm('save');
    SaveASH ME!!";

    }
    ?>

    This now send an email saying " Hello [name],

    Your Message Here"

    Thank you for veiwing this tutorial!

    discuss this topic to forum

    relation tutorial

    No information

    Category

      Ad Management (6)
      Calendars (3)
      Chat Systems (8)
      Content Management (41)
      Cookies and Sessions (12)
      Counters (15)
      Database Related (34)
      Date and Time (15)
      Development (22)
      Discussion Boards (8)
      E Commerce (8)
      Email Systems (14)
      Error Handling (7)
      File Manipulation (24)
      Flash and PHP (6)
      Form Processing (19)
      Guestbooks (12)
      Image Manipulation (21)
      Installing PHP (7)
      Introduction to PHP (23)
      Link Indexing (8)
      Mailing List Management (9)
      Miscellaneous (53)
      Networking (8)
      News Publishing (9)
      OOP (24)
      PEAR (6)
      PHP vs Other Languages (2)
      Polls and Voting (6)
      Postcards (1)
      Randomizing (14)
      Redirection (11)
      Searching (9)
      Security (29)
      Site Navigation (16)
      User Authentication (14)
      WAP and WML (7)
      Web Fetching (8)
      Web Traffic Analysis (15)
      XML and PHP (16)

    New

    Hot