What is the impact of HTML specifications on the formatting of text emails in PHP?

When sending text emails in PHP, the HTML specifications need to be considered as they can affect the formatting of the email content. To ensure proper display of text emails, it is important to use plain text formatting without any HTML tags. This can be achieved by setting the appropriate headers in the email message.

// Set the content-type header to plain text
$headers = 'Content-type: text/plain; charset=utf-8';

// Additional headers
$headers .= 'From: Your Name <your_email@example.com>';

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

if($success){
    echo 'Email sent successfully';
} else {
    echo 'Failed to send email';
}