Search code examples
phpemailclicksendmailclickable

Link in a generated email is not being shown as clickable


I am trying to send email - which is working correctly, but my "Click Here" link doesn't appear as click-able when it's received.

The code I am using is below

$to = $email;
$subject = "Activation";
$message = "We send you an activation email" .'<br>'.' To activate your acount. <a href="activation.php?key='.$key.'">Click Here</a>';
$from = "riaz_qadeer90@yahoo.com";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
if(mail($to,$subject,$message,$headers))
{
    echo "Check your email to activate your acount.";
}

and mail is like this:

We send you an activation email To activate your acount. "Click Here"

but "Click Here" Link is not click-able


Solution

  • This could be down to your client disabling links in email addresses, but it's doubtful.

    Also, the HREF of "Activation.PHP?Key.." is a relative path, that would only be relative to the email client, so the client would not know where to redirect the user to.

    Adding a fully qualified path should help on this one.