How can PHP be configured to send confirmation emails for user registrations in a forum?

To send confirmation emails for user registrations in a forum using PHP, you can use the PHP `mail()` function to send an email to the user with a confirmation link. The link can contain a unique token that identifies the user and confirms their registration when clicked.

<?php
// Generate a unique token for the user
$token = md5(uniqid(rand(), true));

// Send a confirmation email to the user
$to = $user_email;
$subject = 'Forum Registration Confirmation';
$message = 'Click the following link to confirm your registration: http://example.com/confirm.php?token=' . $token;
$headers = 'From: admin@example.com';

// Send the email
mail($to, $subject, $message, $headers);

// Save the token in the database for verification
// This step will vary depending on your database setup
?>