What are best practices for sending confirmation emails with clickable links in PHP?

When sending confirmation emails with clickable links in PHP, it is important to ensure that the links are properly formatted and functional. To achieve this, you should use the PHP `mail()` function to send the email and include the link in the email body using HTML anchor tags. Additionally, make sure to properly encode the link URL to prevent any issues with special characters.

<?php
$to = 'recipient@example.com';
$subject = 'Confirmation Email';
$confirmationLink = 'http://example.com/confirm.php?token=abc123';

$message = '
<html>
<head>
  <title>Confirmation Email</title>
</head>
<body>
  <p>Please click the following link to confirm your email:</p>
  <a href="' . htmlspecialchars($confirmationLink) . '">Confirm Email</a>
</body>
</html>
';

$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$headers .= 'From: sender@example.com' . "\r\n";

mail($to, $subject, $message, $headers);
?>