What is the difference between text/html and text/plain in PHP email headers?

When sending emails in PHP, the "Content-Type" header specifies the type of content in the email body. Using "text/html" indicates that the email body contains HTML content, while using "text/plain" indicates that the email body contains plain text. If you want to send an email with HTML content, use "text/html" in the headers. If you want to send an email with plain text content, use "text/plain" in the headers.

// Example of sending an email with HTML content
$to = "recipient@example.com";
$subject = "HTML Email Example";
$message = "<html><body><h1>Hello, this is an HTML email!</h1></body></html>";

$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";

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