Jump to content

[SOLVED] html email


kat32

Recommended Posts

<?php
include('config.php');
$query = mysql_query("SELECT topics.topictitle, users.email FROM topics LEFT JOIN users ON topics.userid=users.userid WHERE topics.topicid=1") or die(mysql_error());
$row = mysql_fetch_array($query);
$Name = "kat"; 
$sender_email = "kat32@yahoo.com"; 
$topictitle=$row['topictitle'];
$email=$row['email'];
$header = "From: ". $Name . " <" . $sender_email . ">\r\n"; 
$header =. "Content-type: text/html; charset=iso-8859-1\r\n";
$subject = "this is the subject";

$qry = mysql_query("SELECT emailmsg FROM emails WHERE emailmsgid=1") or die(mysql_error());
$row = mysql_fetch_array($qry);
$body=$row['emailmsg'];
$sent = mail($email, $subject, $body, $header);   
if($sent){
   echo 'sent';
}
?>

I have entered html tags

<b>this is the body</b><br>

<i>more text here</i>, etc. in the body using phpmyadmin.

the problem is when I send it to my email, I can see the tags.

it should be

this is the body

more text here

Please help, thanks in advance.

Link to comment
Share on other sites

try the code below.. this is from http://www.php.net/function.mail

 

<?php
// multiple recipients
$to  = 'aidan@example.com' . ', '; // note the comma
$to .= 'wez@example.com';

// subject
$subject = 'Birthday Reminders for August';

// message
$message = '
<html>
<head>
  <title>Birthday Reminders for August</title>
</head>
<body>
  <p><b>Here are the birthdays upcoming in August!</b></p>
</body>
</html>
';

// To send HTML mail, the Content-type header must be set
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// Additional headers
$headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "\r\n";
$headers .= 'From: Birthday Reminder <birthday@example.com>' . "\r\n";
$headers .= 'Cc: birthdayarchive@example.com' . "\r\n";
$headers .= 'Bcc: birthdaycheck@example.com' . "\r\n";

// Mail it
mail($to, $subject, $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.