What potential issue can arise when manually constructing email headers in PHP?

When manually constructing email headers in PHP, a potential issue that can arise is the headers not being formatted correctly, leading to the email not being sent or being marked as spam. To solve this issue, it is recommended to use the `mb_encode_mimeheader` function to properly encode any non-ASCII characters in the headers.

$subject = 'Subject with non-ASCII characters: é';
$subject = mb_encode_mimeheader($subject, 'UTF-8');

$headers = "From: sender@example.com\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/plain; charset=UTF-8\r\n";
$headers .= "Subject: $subject\r\n";

// Additional headers and email content