How should email addresses be formatted in the mail() function in PHP?

When using the mail() function in PHP, email addresses should be formatted correctly to ensure successful delivery. Each email address should be separated by a comma and space if sending to multiple recipients. Additionally, the email addresses should be enclosed in double quotes to ensure proper parsing by the mail() function.

$to = "recipient1@example.com, recipient2@example.com";
$subject = "Subject of the email";
$message = "Body of the email";

// Additional headers
$headers = "From: sender@example.com\r\n";
$headers .= "Reply-To: sender@example.com\r\n";
$headers .= "CC: cc@example.com\r\n";

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