how to send Eamil with PHP code

User Rating: / 0
PoorBest 

how to send Eamil with PHP code

this is a sample HTML page with PHP code to send email

before you start you will need to have 2 pages one to send the email and the second to see the result

and the second page name you can find it in the form action tag which is test.php

don't forget to replace email@domainname with your email to receive email to it

you can have the same code in the second page , just change the page name

<html>
<head>
<title>php email</title>
</head>
<body>

<?php
if (isset($_REQUEST['email']))
//if "email" is filled out, send email
{
//send email
$email = $_REQUEST['email'] ;
$subject = $_REQUEST['subject'] ;
$message = $_REQUEST['message'] ;
mail("email@domainname", "$subject",
$message, "From:" . $email);

}
else
//if "email" is not filled out, display the form
{
echo "<form method='post' >
Email: <input name='email' type='text' /><br />
Subject: <input name='subject' type='text' /><br />
Message:<br />
<textarea name='message' rows='15' cols='40'>
</textarea><br />
<input type='submit' />
</form>";
}
?>
<form action="test.php" method="post">
<table width="400" border="0" cellspacing="2" cellpadding="0">
<tr>
<td width="29%">Your name:</td>
<td width="71%"><input name="name" type="text" id="name" size="32"></td>
</tr>
<tr>
<td>Email address:</td>
<td><input name="email" type="text" id="email" size="32"></td>
</tr>
<tr>
<td>Comment:</td>
<td><textarea name="comment" cols="45" rows="6" id="comment"></textarea></td>
</tr>
<tr>
<td>&nbsp;</td>
<td align="left" valign="top"><input type="submit" name="Submit" value="Send"></td>
</tr>

</table></form>


</body>
</html>

Comments (0)
Only registered users can write comments!
 

g3

g1

elahmad.com