PHP- Send Email Example

Forget Password
1.Enter email send new password on same email id     //OLX
2 a. Enter email  ask Enter the last password you remember
2 b. send a link to generate new password  //gmail




mail.html

<form action="http://mobeduindia.org/mail/series/mail.php" method="post">
<table border="0">
<tbody>
<tr>
<td>To :</td>
<td><input name="to" type="text" /></td>
</tr>
<tr>
<td>From :</td>
<td><input name="from" type="text" /></td>
</tr>
<tr>
<td>From Name :</td>

<td><input name="name" type="text" /></td>
</tr>
<tr>
<td>Subject :</td>
<td><input name="subject" type="text" /></td>
</tr>
<tr>
<td>Message :</td>
<td><textarea cols="30" rows="10" name="message"></textarea></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Send" /></td>
</tr>

</tbody></table>
</form>


mail.php
<html>
<head>
<title>Mail Status</title>
</head>
<body>

<?php

$to=$_POST['to'];
$from=$_POST['from'];
$name=$_POST['name'];
$subject=$_POST['subject'];
$message=$_POST['message'];



$res=mail($to, $subject, $message);
if($res==true)
echo "<br /> Mail sent Successfully";-
else
echo "<br /> Unable to Send mail.";

?>
<br><a href="<?php echo $_SERVER['HTTP_REFERER']?>">Go Back</a>
<br><a href="YOUR_URL_HERE">Go Back</a></body>
</html>

Reactions: