php Form.net

Free PHP forms, scripts, resources and tutorials.

Sending HTML Email With Images :: PHP Tutorial

Example:
/////////////
//index.php
/////////////
<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
/////////////


<?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);
?>

Comments


Add a Comment

Name:


Comment:




Sponsors



Google Meta Tags Generator Online
Create your own meta tags using our free code generator.

BuzzBoost Css Generator Online
Free Google BuzzBoost CSS Style Generator Online

Text Ads Generator
Create Your Own HTML Ad Using Our Free HTML Editor

Link Style Generator
Free CSS Style Sheet Generator for Links

CopyRight phpForm.net