What are the potential pitfalls of using iso-8859-1 charset in PHP email messages?

Using iso-8859-1 charset in PHP email messages can lead to encoding issues, especially when sending emails with special characters or non-ASCII characters. To avoid this problem, it's recommended to use UTF-8 charset for better compatibility and support for a wider range of characters.

// Set the charset to UTF-8 in PHP email messages
$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";

// Send the email
mail($to, $subject, $message, $headers);