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 = "[email protected]"; 
$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
https://forums.phpfreaks.com/topic/152702-solved-html-email/
Share on other sites

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

 

<?php
// multiple recipients
$to  = '[email protected]' . ', '; // note the comma
$to .= '[email protected]';

// 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 <[email protected]>, Kelly <[email protected]>' . "\r\n";
$headers .= 'From: Birthday Reminder <[email protected]>' . "\r\n";
$headers .= 'Cc: [email protected]' . "\r\n";
$headers .= 'Bcc: [email protected]' . "\r\n";

// Mail it
mail($to, $subject, $message, $headers);
?>

Link to comment
https://forums.phpfreaks.com/topic/152702-solved-html-email/#findComment-801963
Share on other sites

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.