What is the purpose of the fifth parameter in the mail() function in PHP?

The fifth parameter in the mail() function in PHP is used to specify additional headers to be included in the email. This can be useful for adding things like CC, BCC, or setting the content type of the email. By using this parameter, you can customize the email further and include additional information or functionality.

$to = "recipient@example.com";
$subject = "Test Email";
$message = "This is a test email.";
$headers = "From: sender@example.com\r\n";
$headers .= "CC: cc@example.com\r\n";
$headers .= "BCC: bcc@example.com\r\n";

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