index.php(form) - Code:
<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.php - Code:
<?php
$to = $_POST['to'];
$msg = $_POST['msg'];
//Image in e-mail
$mailimg = '
<img src="http://www.example.com/images/sample.jpg"</a>
';
//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>
';
//To send HTML mail, the Content-type header must be set:
$headers='MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html;charset=iso-8859-1' . "\r\n";
$headers .= 'From: System Admin <x@domain.com>' . "\r\n";
$bodys .= "$msg <br>";
$bodys .= "$mailimg";
$subject .="My HTML Mail";
$body = $body . $bodys;
mail($to, $subject, $body, $headers);
?>
discuss this topic to forum
01/01/08