Ad block is installed and active. Please support us by disabling it.
HomeSaturday, January 20, 2018, 16:48:20
13

Sending HTML Email With Images - PHP Tutorial

Tuesday, February 10, 15, 12:06:50, 3 Yaers Ago Via wain, Hits: 7240
Sending HTML Email With Images - Upload Image with PHP - Creating Dynamic Webpages Using PHP and MySQL - Select, Delete, Update..
Download:
http://osfiles.net/project/HTML-email

Example:
index.php
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
//message
$message = $_POST['msg'];
//mail body - image position, background, font color, font size...
$body ='<html>
<head>
<style>
body
{
background: #fff;
font-family: "lucida grande", tahoma, verdana;
font-size:16px;
font-weight: bold;
color: #fff;
}
.content{
overflow:hidden;
background-color: #336699;
margin: 10px;
padding:10px;
}
</style>
</head>
<body>
<div class="content">
<h1>My HTML Mail</h1>
'.$message.'<br />
<img src="http://phpform.net/images/contact2.png" /><br />
</div>
</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 <noreply@example.com>' . "\r\n";
$to = $_POST['to'];
$subject = "My HTML Mail";
//mail function
$mail = mail($to, $subject, $body, $headers);
if(!$mail) {
echo "Error sending email";
} else {
echo "Your email was sent successfully.";
}
?>

michael Tuesday, February 10, 2015, 14:22:57

@wain great tutorial! Thanks

Sign In

Sponsor

Related

PHP form with file upload

Advanced Contact Form with email and form field validation. It allows your visitors to send you an email directly from your website.

Upload Attachment - PHP Tutorial

Upload attachment with PHP example, Requirement(s): PHP server

PHP Jquery Form

PHP Jquery Form allow your visitors to contact you directly from your website.

Jquery PHP Contact Form

This script allows your visitors to send you an email directly from your website.

Upload and Resize an Image with PHP

Tutorial - How to upload and resize image with PHP

PHP $_POST Function

Collect values from a form sent with method post

PHP Fwrite : fwrite

php write to file - how to write data to a file using the php frwite function

How to insert new line (IP Address) with fwrite

How to insert new line (IP Address) with fwrite, Get IP address and write to file.

PHP highlight_string - PHP Tutorial

Outputs or returns a syntax highlighted version of the given PHP code using the colors defined in the built-in syntax highlighter for PHP. Requirement(s): PHP Server.

Advanced Contact Form - PHP Script

Advanced Contact Form with email and form field validation. Features: HTML Output(Response), Captcha Image.
About Author

wain

Date Registered: Sun, Feb 8, 15
Last Time Online: Thu, Jun 15, 17
So far has created 115 entries.
wain
This author has not yet filled in any details.