What are the potential pitfalls to be aware of when sending emails with HTML and plain text content using PHP?

When sending emails with both HTML and plain text content using PHP, a potential pitfall to be aware of is that some email clients may not properly display the HTML content, leading to a less than optimal user experience. To address this issue, it is recommended to include both HTML and plain text versions of the email content in the email headers.

// Define the email headers
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type: text/html; charset=UTF-8" . "\r\n";

// Define the plain text version of the email content
$plain_text_content = "This is the plain text version of the email content.";

// Define the HTML version of the email content
$html_content = "<p>This is the HTML version of the email content.</p>";

// Send the email with both HTML and plain text content
mail($to, $subject, $html_content, $headers);