• home
  • forum
  • my
  • kt
  • download
  • Sending Email with PHP

    Author: 2008-08-24 10:33:39 From:

    • The mail() function allows you to send emails directly from a script. The parameters of this function are as follows:
    • Recipient E-mail address
    • E-mail Subject
    • E-mail Message
    • Sender E-mail address

      <?php
      mail
      ($email$subject$body"From: $email");
      ?>
  • Recipient E-mail address
  • E-mail Subject
  • E-mail message
  • Sender E-mail address
    send.php

    <?php
    //Recipient E-mail address
    $email $_POST['email'];
    //E-mail Subject
    $subject $_POST['subject']; 
    //E-mail message
    $body $_POST['body'];
    //Sender E-mail address
    $emaile $_POST['emaile'];
    mail($email$subject$body"From: $emaile");
    ?>
  • index.html
    The line


    <form name="form" action="send.php" method="POST">

    tells the browser which PHP file will process the form and what method to use for sending data.


    <form name="form" action="send.php" method="POST">
    <table width="100%" border="0">
    <tr>
      <td width="120">To (E-Mail)</td>
      <td><input type=text name="email"  size="30"></td>
    </tr>
    <tr>
      <td width="120">Subject</td>
      <td><input type=text name="subject" size="30"></td>
    </tr>
    <tr>
      <td width="120" valign="top">Comments (Body)</td>
      <td>
      <textarea name="body" rows="5" cols="40">
      </textarea>
     </td>
    </tr>
    <tr>
      <td width="120">From (E-Mail)</td>
      <td><input type=text name="emaile" size="30"></td>
    </tr>
    <tr>
      <td>
      </td>
      <td>
      <input type="submit" name="Submit" value="Submit">&nbsp;
    <input type="reset" name="Reset" value="Reset">
    </td>
    </tr>
    </table>
    </form>


    discuss this topic to forum

    relation tutorial

    No relevant information

    Category

      Ad Management (4)
      Calendars (3)
      Chat Systems (7)
      Content Management (6)
      Cookies and Sessions (8)
      Counters (8)
      Database Related (8)
      Date and Time (9)
      Development (6)
      Discussion Boards (7)
      E Commerce (6)
      Email Systems (9)
      Error Handling (5)
      File Manipulation (10)
      Flash and PHP (4)
      Form Processing (17)
      Guestbooks (12)
      Image Manipulation (21)
      Installing PHP (7)
      Introduction to PHP (24)
      Link Indexing (8)
      Mailing List Management (9)
      Miscellaneous (54)
      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