What role does the MIME-Version header play in PHP email headers?

The MIME-Version header in PHP email headers specifies the MIME (Multipurpose Internet Mail Extensions) version being used in the email. It is important to include this header to ensure that email clients can correctly interpret the content type of the email. Without this header, the email may not display correctly for recipients.

// Add MIME-Version header to PHP email headers
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// Additional headers
$headers .= 'From: Your Name <youremail@example.com>' . "\r\n";

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