What are the potential pitfalls of not following RFC standards when sending emails with PHP?

Potential pitfalls of not following RFC standards when sending emails with PHP include emails being marked as spam, not being delivered at all, or not displaying correctly in the recipient's email client. To ensure proper email delivery, it is important to adhere to RFC standards when formatting email headers and content.

// Example of sending an email with proper RFC-compliant headers
$to = 'recipient@example.com';
$subject = 'Test Email';
$message = 'This is a test email.';
$headers = "From: sender@example.com\r\n";
$headers .= "Reply-To: sender@example.com\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

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