What are potential issues with email headers and content type when sending emails in PHP?

Potential issues with email headers and content type when sending emails in PHP include emails being flagged as spam or not displaying correctly in the recipient's inbox. To solve this, ensure that the email headers are properly formatted and that the content type is set to text/html if you are sending HTML emails.

// Set email headers
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";

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