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']); } } Link to comment https://forums.phpfreaks.com/topic/69383-stored-html-in-a-text-field-in-a-table-on-a-mysql-database-send-via-email/ 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? Link to comment https://forums.phpfreaks.com/topic/69383-stored-html-in-a-text-field-in-a-table-on-a-mysql-database-send-via-email/#findComment-348748 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); } } Link to comment https://forums.phpfreaks.com/topic/69383-stored-html-in-a-text-field-in-a-table-on-a-mysql-database-send-via-email/#findComment-348936 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.