Hi justlukeyou,
The above code snippet you have posted does have some clear indications as to why your HTML is showing up as plain text, the content-type header currently is commented out in the above code there for its been sent as Content-type: text/plain. To fix this you would simply un-comment that line but another issue would arise by doing that as the line begins with just $header = which would overwrite the previous headers set therefor you would need to change it to read $headers .= which would extend the previous header lines.
Now I'm hoping you understood all that so we can move onto the bulk of the issues which is the un-readable code, at the moment its hard to see where the mail function ends and what is doing what within it, to clean things up I personally like to set everything in variables and then call them as its far more readable and easier to maintain which as a developer should be of your top priorities during development. On that same note you will notice that the above code also has two else statements which would never work as it would always only ever hit one of them rather then both, see the below which is a cleaned up example of your above snippet which would need some modifications on your part but overall should work without any issues.
PHP Code:
// Some kind of validation here
$validationPassed = true;
$validationMessage = '';
if ($validationPassed) {
$from = "admin@website.com"; // Change this address within quotes to your address
$to = "someone@somewhere.com"; // The email address of the recepient
$subject = "website.com - Reset Password Request"; // The subject for the email address
$message = "<a href='http://website.com' rel='nofollow'><img src='/images/logo.png' alt='website.com'/></a>\n";
$message .= "This is in response to your request for login details at website.com\n\n";
$message .= "Hello $row->firstname $row->surname\n";
$message .= "<a href='http://www.website.com'>Click Here</a>\n";
$message .= "Password: $row->password\n\n";
$message .= "Thank You\nSite Admin";
$headers = "Reply-to: $from\n";
$headers .= "From: $form\n";
$headers .= "Errors-to: $form\n";
$headers .= "Content-Type: text/html; charset=iso-8859-1\n" . $headers;
if (mail($to, $subject, $message, $headers)) {
echo "<div align='center'><strong>THANK YOU</strong><br />Your password is posted to your email address, please check your inbox/spam box.</div>";
} else{
echo "<div align='center'>There is a problem in sending login details to your address, please contact site admin.<br /><br /><input type='button' value='Retry' onclick='history.go(-1)'></div>";}
}
} else {
echo "<div align='center'>$validationMessage<br /><br /><input type='button' value='Retry' onClick='history.go(-1)'></div>";
}
Bookmarks