my html email is not outputting html format instead it is showing the tags // format body text $line = "Know the rules! Know the stakes! Know when to quit!"; /** * Setup the e-mail information */ $subject = "New Trade Alert"; //$body $body = "<html> <head> <title>Title</title> </head> <body> <table> <tr> <td class=\"line\">$line </td> </tr> </table> </body> </html>"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers = "From: <tradealerts@website.com>\r\n"; $headers .= "Reply-To: tradealerts@website.com"; /** * Grab the e-mails from the database, and e-mail them to the user. */ $query = mysql_query("SELECT * FROM member WHERE trader='$trader' AND subscribe='yes'"); while ($row = mysql_fetch_array($query)) { if (mail($row["email"], $subject, $body, $headers)) { // email was a success, sent } else { // sending of e-mail was a failure } } PHP:
Look at your header variable: $headers .= $headers = $headers .= PHP: See, the 2nd time, you reset the variable so you don't parse the html header. This should work: // format body text $line = "Know the rules! Know the stakes! Know when to quit!"; /** * Setup the e-mail information */ $subject = "New Trade Alert"; //$body $body = "<html> <head> <title>Title</title> </head> <body> <table> <tr> <td class=\"line\">$line </td> </tr> </table> </body> </html>"; $headers = 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= "From: <tradealerts@website.com>\r\n"; $headers .= "Reply-To: tradealerts@website.com"; /** * Grab the e-mails from the database, and e-mail them to the user. */ $query = mysql_query("SELECT * FROM member WHERE trader='$trader' AND subscribe='yes'"); while ($row = mysql_fetch_array($query)) { if (mail($row["email"], $subject, $body, $headers)) { // email was a success, sent } else { // sending of e-mail was a failure } } PHP:
I agree with elias, your second $headers line is overwriting your first $headers line, use .= to append