This tutorial will show you how to send email with HTML output in PHP.
index.php(form)
<form name="myform" action="mail.php" method="POST">
<strong>E-mail</strong><br/>
<input type=text name="to" size="25"><br>
<strong>Your Message</strong><br/>
<input type=text name="msg" size="25"><br>
<INPUT TYPE="SUBMIT" VALUE=" Submit">
<INPUT TYPE="RESET" VALUE=" Reset">
</form>
Mail Body - Position, background, font color, font size...
$body ='
<html>
<head>
<style>
<!--
body, P.msoNormal, LI.msoNormal
{
background-position: top;
background-color: #336699;
margin-left: 10em;
margin-top: 1em;
font-family: "verdana";
font-size: 10pt;
font-weight:bold ;
color: "000000";
}
-->
</style>
</head>
</body>
';
Image in e-mail
$mailimg = '<img src="http://yoursite.zz/images/sample.jpg"</a>';
To send HTML mail, the Content-type header must be set:
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: System Admin <noreply@domain.com>' . "\r\n";
mail.php
<?php
$to = $_POST['to'];
$msg = $_POST['msg'];
$mailimg = '<img src="http://phpform.net/tell/images/sample.jpg"</a>';
$body ='
<html>
<head>
<style>
<!--
body, P.msoNormal, LI.msoNormal
{
background-position: top;
background-color: #336699;
margin-left: 10em;
margin-top: 1em;
font-family: "verdana";
font-size: 10pt;
font-weight:bold ;
color: "000000";
}
-->
</style>
</head>
</body>
';
$headers='MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: System Admin <noreply@domain.com>' . "\r\n";
$bodys .= "$msg <br>";
$bodys .= "$mailimg";
$subject .="My HTML Mail";
$body = $body . $bodys;
mail($to, $subject, $body, $headers);
?>
Rate this Script @ The PHP Resource Index
http://php.resourceindex.com/rate
Rate this Script @ Hot Scripts.com
http://www.hotscripts.com/rate/73170.html