subject

Sending HTML Email using PHP

PHP has ability to send the mail from the domain using mail function,  this session we are going to discuss about the mail function and its benefit.  First we will create simple form and PHP script to send mail.

Our html file have to, subject and message to send mail.

<html>
<head>
<title>Codeasearch.com - Sending HTML Email using PHP - Email form</title>
</head>
<body>
<table>
<form action="mail.php" method="post">
<tr>
<td>To</td>
<td><input type="text" name="txtTo" /></td>
</tr>
<tr>
<td>Subject</td>
<td><input type="text" name="txtSubject" /></td>
</tr>
<tr>
<td>Message</td>
<td><textarea rows="6" cols="30" name="txtMessage"></textarea></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="btn" value="Send Mail" /></td>
</tr>
</form>
</table>
</body>
</html>

Our server side script will send the post data using mail function, which mentioned in below. If you are trying to send with html content It will send as it is (html tag in email) Continue reading…