What are common issues with encoding German umlauts in email subjects when sending emails with PHP?

Common issues with encoding German umlauts in email subjects when sending emails with PHP include the characters getting garbled or displayed incorrectly in the recipient's email client. To solve this issue, you can use PHP's `mb_encode_mimeheader` function to properly encode the subject line with UTF-8 encoding.

$subject = 'Äpfel und Birnen';
$subject_encoded = mb_encode_mimeheader($subject, 'UTF-8', 'Q');
$headers = 'Content-Type: text/plain; charset=UTF-8' . "\r\n";
$headers .= 'Content-Transfer-Encoding: quoted-printable' . "\r\n";
$headers .= 'Subject: ' . $subject_encoded . "\r\n";

mail('recipient@example.com', 'Subject', 'Message', $headers);