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

Link to comment
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.