What common issue with PHP form mailers can cause Umlauts to be displayed incorrectly in emails?

The common issue with PHP form mailers that can cause Umlauts to be displayed incorrectly in emails is the character encoding not being set properly. To solve this issue, you can set the character encoding to UTF-8 in the email headers before sending the email.

<?php
$to = "recipient@example.com";
$subject = "Test Email";
$message = "This is a test email with Umlauts: äöü";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers .= "From: sender@example.com" . "\r\n";

mail($to, $subject, $message, $headers);
?>