Jump to content

[SOLVED] How to get HTML to render in email


peranha

Recommended Posts

When I go to reset pass, and send the email, it comes like this.

 

Your password reset link <BR><BR>Click on the following link to reset your password <BR>http://mberanek.dyndns.org:8204/resetpass.php?u=mike&passkey=2059221d43897d387ae7a351db2cd6510753e707<BR><BR>Please do not reply to this email.

 

Here is the page code.

 

<?php
if (!isset($_POST['submit'])) {
// form not submitted
?>

<?php
}
else {
// form submitted

// open connection
$connection = mysql_connect($server, $user, $pass) or die ("Unable to connect!");

// select database
mysql_select_db($db) or die ("Unable to select database!");

// get form input
// check to make sure it's all there
// escape input values for greater safety
$username = empty($_POST['username']) ? die ("<b class=red>Enter A User Name</b>") : mysql_real_escape_string(strip_tags($_POST['username']));

// create query
$query = "SELECT COUNT(*) FROM " . $pre . "users WHERE username = '$username'";

// execute query
$result = mysql_query($query) or die ("Error in query: $query. ".mysql_error());

$query_data1 = mysql_fetch_row($result);

$numrows = $query_data1[0];

if ($numrows < 1) {

echo "<H1>";
echo "<b class=yellow>User Name you entered" . $username . "</b>";
echo "<b class=red>There isn't a user with this username.  Click <a href=forgotpass.php>here</a> if you put in the wrong username. </b>";
echo "</H1>";
exit;
}

ELSE {

$query = "SELECT Email, uniqueid FROM " . $pre . "users WHERE username = '$username'";

$result = mysql_query($query) or die ("Error in query: $query. ".mysql_error());

$row = mysql_fetch_row($result); 

$Email = $row[0];
$uniqueid = $row[1];

// send e-mail to ...
$to=$Email;

// Your subject
$subject="Reset Password link";

// From
$header="from: bscardealers <automail@bscardealers>";

// Your message
$message="Your password reset link <BR><BR>";
$message.="Click on the following link to reset your password <BR>";
$message.="http://mberanek.dyndns.org:8204/resetpass.php?u=$username&passkey=$uniqueid";
$message.="<BR><BR>Please do not reply to this email.";
// send email
$sentmail = mail($to,$subject,$message,$header);

}

// if your email succesfully sent
if($sentmail){
echo "<b class=red>The link to reset you password has been sent to your Email address. <a href=login.php>Login</a></b>";
}
else {
echo $Email;
echo $uniqueid . "<BR>";
echo $message;
echo "<b class=red>Cannot send Password reset link to your e-mail address</b>";
}

// close connection
mysql_close($connection);
}
?>

Try replacing all the <.br> tags with \n's, like this:

 

<?php

$message="Your password reset link \n\n";
$message.="Click on the following link to reset your password \n";
$message.="http://mberanek.dyndns.org:8204/resetpass.php?u=$username&passkey=$uniqueid";
$message.="\n\nPlease do not reply to this email.";

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.