Write a PHP project script to design HTML Login form, validate it and
compose/write an email with the following details:
To:
From:
Subject:
Message:
setc1email.html
<html>
<form action="setc1email.php" method="post">
TO<input type="text" name="to"><br>
SUBJECT<input type="text" name="subject"><br>
MESSAGE<input type="text" name="message"><br>
FROM<input type="text" name="from"><br>
<input type="submit" name="submit" value="submit">
</form>
</html>
setc1email.php
<?php
$to=$_POST['to'];
$from=$_POST['from'];
$subject=$_POST['subject'];
$message=$_POST['message'];
if(filter_var($to,FILTER_VALIDATE_EMAIL) && filter_var($from,FILTER_VALIDATE_EMAIL))
{
echo "valid email<br>";
$ans=mail($to,$subject,$message,$from);
if($ans)
{
echo "mail send successfully<br>";
}
}
else
{
echo "mail is invalid..<br>";
echo "Re enter email..<br>";
echo "<html>";
echo "<a href=setb1email.html>PLEASE CLICK HERE </a>";
echo "</html>";
}
?>
0 Comments
If anyone has Doubts or suggestions please let me know