How can the sender be controlled when using Windows sendmail in PHP?

When using Windows sendmail in PHP, the sender can be controlled by setting the additional parameters in the mail() function. You can specify the sender email address and name using the "-f" parameter to set the 'From' header.

$to = "recipient@example.com";
$subject = "Test Email";
$message = "This is a test email.";
$headers = "From: Sender Name <sender@example.com>";
$additional_headers = "-f sender@example.com";
mail($to, $subject, $message, $headers, $additional_headers);