What are some potential solutions for the issue of receiving only letters and question marks in HTML emails with UTF-8 data in PHP?

Issue: The problem of receiving only letters and question marks in HTML emails with UTF-8 data in PHP can be solved by setting the correct Content-Type header in the email message to ensure proper encoding and decoding of UTF-8 characters.

// Set the Content-Type header to specify UTF-8 encoding
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";

// Additional headers
$headers .= 'From: Your Name <yourname@example.com>' . "\r\n";

// Your message content with UTF-8 characters
$message = '<html><body>';
$message .= '<p>Example UTF-8 content: 你好</p>';
$message .= '</body></html>';

// Send the email with UTF-8 encoding
mail('recipient@example.com', 'Subject', $message, $headers);