Send a html email in php

ApocDen 0 Tallied Votes 222 Views Share

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.

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

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

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

   Hello daniweb  , <br>

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

	mail($to, $subject, $message, $headers) or die ("Failure");
metalix 0 Posting Whiz in Training

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 :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.