What is the correct syntax for the "From" header in an email sent using PHP's mail function?

When sending an email using PHP's mail function, the "From" header should include the sender's email address and optionally their name. The correct syntax for the "From" header is "From: sender@example.com" or "From: Sender Name <sender@example.com>". This ensures that the email is properly identified as being sent from the specified sender.

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

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