创建可点击验证链接PHP邮件

For email verification, I am creating a hash for each user and then sending a verification email to the user.The message body is given below.

 $message_body = '
        Hello '.$first_name.',

        Thank you for signing up!

        Please click this link to activate your account:

        http://www.alphaktu.co.in/verify.php?email='.$email.'&hash='.$hash  ;

But I want to convert the verification link to a clickable link.

For starters, you might want to use HTML links within your email body, something like this:

  $message_body = '

    Hello '.$first_name.',

    Thank you for signing up!
    Please click this link to activate your account:

    <a href="http://www.alphaktu.co.in/verify.php?email='.$email.'&hash='.$hash.'"> 
         Verification Link 
    </a>'  ;

Secondly, for this to actually work, you need to use the HTML MIME type when setting headers for your email. If you haven't, it will look something like this:

// Always set content-type when sending HTML email
    $headers = "MIME-Version: 1.0" . "
";
    $headers .= "Content-type:text/html;charset=UTF-8" . "
";

This basically tells the browser to interpret the HTML code with your message body as actual HTML, and not plain text.