PHPmailer Wrong Encryption

Here is my Code for Register.php for a Login System with MySQL:

require_once 'config.php';
require_once 'dbh.php';
require_once 'functions.php';
require_once 'PHPMailer/PHPMailerAutoload.php';
if (isset($_POST['register']))
$password=password_hash($password, PASSWORD_DEFAULT);
$vcode=substr(md5(uniqid(rand(), true)), 16, 10);
if (check() === 0){
$sql="INSERT INTO users (fname,lname,email,password,vcode) VALUES ('$fname','$lname','$email','$password','$vcode')";
$fullname=$fname.' '.$lname;
$id= $conn->insert_id;
$mail = new PHPMailer;
//$mail->SMTPDebug = 3;                               
$mail->Host = MAILHOST;  
$mail->SMTPAuth = true;                           
$mail->Username = EMAIL;       
$mail->Password = SECRET;
$mail->SMTPSecure = MAILSECURE;                       
$mail->Port = MAILPORT;                                 
$mail->setFrom(EMAIL, 'CloudMate SSO');
$mail->addReplyTo('[email protected]', 'CloudMate Support');
$mail->Subject = 'Single Sign ON verification link';
$mail->Body    = 'Click on the link to verify your account <a 
href="{$vcode}&id={$id}">click here</a>';
    $error='User already exists';

The Problem is Email Verification Links that are being Sent. The Current Configuration is with SSL and TLS and It encrypts the User ID and VCODE needed in Verification Link. I tried the same with HTTP instead of HTTPS and Its working fine then.

Email Link for Verification:
%7B$vcode%7D and %7B$id%7D got encrypted when they should be just Numbers. How to FIx that?

You’ve used single quotes on this string; variables included in single quoted strings are not evaluated. Read here to see the differences between single and double quoted strings.

$mail->Body = "Click on the link to verify your account <a href=\"{$vcode}&id={$id}\">click here</a>";

See how I’ve used double quotes here. You can still use double quotes in the string itself, but you have to escape them using a backslash - you can see where I’ve done this in the href attribute.

Sponsor our Newsletter | Privacy Policy | Terms of Service