What specific settings and configurations are necessary to set up an SMTP server on a local Windows XP machine for sending emails via PHP?

To set up an SMTP server on a local Windows XP machine for sending emails via PHP, you will need to install an SMTP server software like hMailServer, configure it to listen on localhost, set up PHP to use the SMTP server, and ensure that the necessary ports are open in your firewall.

<?php
ini_set('SMTP', 'localhost');
ini_set('smtp_port', 25);

$to = "recipient@example.com";
$subject = "Test Email";
$message = "This is a test email.";
$headers = "From: sender@example.com";

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