woocha Posted September 14, 2007 Share Posted September 14, 2007 I am emailing a field from a MySQL DB table. The field type is text. Basically, it is an accept email. How can I make it so the email sent is capable of emailing HTML to make the message more attractive? I have already tried to insert < html > into the text field, but that doesn't work....The received email, just diplays the text < html > and then the rest of the text. here is my code: if ($action == "decline") { $query = "delete from orders where id=$id and merchant=$merchant"; mysql_query( $query); if ($sendemail == "yes") { mail("\"$name\" <$email>", "Your order has been declined!", stripslashes($r['emaildecline']), "From: \"".$r['company_name']."\" <".$r['email'].">\nReply-To: ".$r['email']); } } Quote Link to comment Share on other sites More sharing options...
teng84 Posted September 15, 2007 Share Posted September 15, 2007 do you have something like this "MIME-Version: 1.0" . "\r\n"; "Content-type:text/html;charset=iso-8859-1" . "\r\n"; to tell the mail function that you are sending html? Quote Link to comment Share on other sites More sharing options...
woocha Posted September 15, 2007 Author Share Posted September 15, 2007 I updated the php code and it seems to be working very well now...If you see anything esle possible wrong, could you plaese tell me about it? thank you $company_name = $r['company_name']; $company_email = $r['email']; if ($action == "decline") { $query = "delete from orders where id=$id and merchant=$merchant"; mysql_query( $query); $message = stripslashes($r['emaildecline']); $headers = "MIME-Version: 1.0 \r\n" . "Content-type: text/html; charset=iso-8859-1\r\n" . "From: $company_name <$company_email>\r\n" . "Reply-To: $company_email"; if ($sendemail == "yes") { mail("\"$name\" <$email>", "Your order has been declined!", $message, $headers); } } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.