Jump to content

stored HTML in a text field in a table on a MySQL Database send via email


woocha

Recommended Posts

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']); 
}
}

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); 
}
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.