PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Hey guys i've created a register form which sends a validation email to the user. Everything works fine except the url link which it gives to click doesn't allow the user to click it. it appears but not as a url just blue static text as part of the message. However i have given it the <a href> to make it a url. code below any ideas?
<? function send_validation_email()
{
$firstname = $_POST['firstName'];
$surname = $_POST['lastName'];
$username = $_POST['username'];
echo $firstname
." "
. $surname
. ", You have succesfully become a customer of Funky Monkey Records. You will recieve a validation e-mail so you can activiate your account.<br><br>
";
$link_id = db_connect();
$query= mysql_query("Select customer_id from customers where username = '$username'");
$row = mysql_fetch_array($query);
$customer_id = $row['customer_id'];
$emailMessage = "<html><body>Dear ". $firstname . " " . $surname. "<br><br>
You have registred an account at Funky Monkey Records. In order to complete registration you have to click this activation
link:<br><a href="validate.php?page=validate&customer_id=" . $customer_id . "">validate.php?page=validation&customer_id=" . $customer_id . "</a></body></html>";
$to = $_POST['email'];
$from = "mmc01ms@hotmail.com";
$message= $emailMessage;
$subject = "Succesfully registred as ". $username;
$headers = "From: $from";
if(mail($to,$subject,$message,$headers)){
} else{
echo"<br><br>Failed sending an email";
}
}
?>
Dear manpreet Smith
You have registred an account at Funky Monkey Records. In order to complete registration you have to click this activation link:
validate.php?page=validation&customer_id=123577
Does the mail client allow html? Its not just displaying the html code, so it must be doing something with the html code. You will also probably want the full URL in the link as at the moment it wont go to your site as its a local link - this might be known in some clients and so doesnt show the link as its invalid.
thanks for the speedy reply however i've tried what you said and no joy. Also i've appended my code to allow html code. Hotmail does allow html markup. I've also inlcuded what markup hotmail returns below. Any other ideas?
<? function send_validation_email()
{
$firstname = $_POST['firstName'];
$surname = $_POST['lastName'];
$username = $_POST['username'];
echo $firstname
." "
. $surname
. ", You have succesfully become a customer of Funky Monkey Records. You will recieve a validation e-mail so you can activiate your account.<br><br>
";
$link_id = db_connect();
$query= mysql_query("Select customer_id from customers where username = '$username'");
$row = mysql_fetch_array($query);
$customer_id = $row['customer_id'];
$emailMessage = "<html><body>Dear ". $firstname . " " . $surname. "<br><br>
You have registred an account at Funky Monkey Records. In order to complete registration you have to click this activation
link:<br><a href="http://146.227.22.22/~php32/validate.php?page=validate&customer_id=".$customer_id."">http://146.227.22.22/~php32/validate.php?page=validation&customer_id=".$customer_id."</a></body></html>";
$to = $_POST['email'];
$from = "mmc01ms@hotmail.com";
$message= $emailMessage;
$subject = "Succesfully registred as ". $username;
$headers = "MIME-Version: 1.0\r\n";
$headers.= "Content-type: text/html;";
$headers.= "charset=iso-8859-1\r\n";
$headers.= "From: $from \r\n";
if(mail($to,$subject,$message,$headers)){
} else{
echo"<br><br>Failed sending an email";
}
}
?>
<div>
Dear manpreet Smith<br><br>
You have registred an account at Funky Monkey Records. In order to complete registration you have to click this activation
link:<br><a>http://146.227.22.22/~php32/validate.php?page=validation&customer_id=123579</a>
<font color="#000000"></div>