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);
}
?>

Link to comment
Share on other sites

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.";

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.