953,275 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?

Send a html email in php

0
By Denis Sellu on Aug 4th, 2010 9:32 pm

for this to work you need to add some text boxes and name them accordingly, make sure when you add a text box add

$_POST["new_text field"] = $new_text field;

etc etc. html coding can be used within the html tags only.

<?php
$_POST["name"] = $name;
$_POST["email"] =  $email;
nl2br($_POST["comment"])=  $comment;

$to = "daniweb@daniweb.com";
$from = "".$_POST["email"]."";
$subject = "Code Snipplet for daniweb ";

$message = "<html>
   <body background=\"#4B4B4B\">
   <h1>Code Snipplet for daniweb</h1>

   Hello daniweb  , <br>

    <center>
Name: $name <br>
Email: $email <br>
Comment: $comment <br>
    </center>
  </body>
</html>";
   
    $headers  = "From: Site contact form <daniweb@daniweb.com>\r\n";
    $headers .= "Content-type: text/html\r\n";

	mail($to, $subject, $message, $headers) or die ("Failure");
?>

You should also add the smtp info so it doesn't end up in the users spam folder.
also some email programs will display html coding rather than processing it if it doesn't use something like smtp :) :)

SMTP == send mail transfer protocol :)

metalix
Posting Whiz in Training
218 posts since Mar 2010
Reputation Points: 13
Solved Threads: 34

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: