How can one ensure proper display of German umlauts in email subjects when viewed in different email clients like Thunderbird and Outlook?

To ensure proper display of German umlauts in email subjects when viewed in different email clients like Thunderbird and Outlook, it is important to encode the umlaut characters using UTF-8 encoding. This can be done by using PHP's `mb_encode_mimeheader()` function to properly encode the subject line before sending the email.

$subject = 'Subject with German umlauts: äöü';
$subject_encoded = mb_encode_mimeheader($subject, 'UTF-8', 'B');
$headers = 'Content-Type: text/plain; charset=UTF-8' . "\r\n";
$headers .= 'Content-Transfer-Encoding: base64' . "\r\n";
mail('recipient@example.com', $subject_encoded, 'Email content', $headers);