- 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");
?>
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">
<input type="reset" name="Reset" value="Reset">
</td>
</tr>
</table>
</form>
discuss this topic to forum
