I'm trying to include a hyperlink in my email but it is just showing as plain text. I'm probably just miss-using my quotes in the $BODY section and I'm just not seeing it.
echo "Activation Code: " . $emailString . " <br>";
mysql_query("INSERT INTO accounts
(name, pass, email, activated, code) VALUES('$user', '$pass', '$email', 'false', '$emailString') ")
or die(mysql_error());
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$to = "$email";
$subject = "Hi!";
$body = '<html><head></head><body> Thank you for registering! Please go to this address to activate your account: <a href="'. $_SERVER['SERVER_NAME'] .'/PHP%20project/activate.php?activationCode='.$emailString.'">' .$emailString . '</a> </body></html>';
$from = "From:---@gmail.com";
if (mail($to, $subject, $body, $from, $headers)) {
echo("<p>Message successfully sent!</p>");
} else {
echo("<p>Message delivery failed...</p>");
}
You're using it wrong:
The
mail()
function does not have a$from
parameter. You ought to throw it into$headers
as well.