What are the best practices for handling line breaks and carriage returns in HTML emails generated using PHP?

When generating HTML emails using PHP, it's important to handle line breaks and carriage returns properly to ensure the content displays correctly across different email clients. One common approach is to use the PHP `nl2br()` function to convert newline characters to `<br>` tags in the email content before sending it out.

&lt;?php
// Sample email content with line breaks
$emailContent = &quot;Hello,\n\nThis is a test email.\n\nRegards,\nJohn&quot;;

// Convert newline characters to &lt;br&gt; tags
$emailContent = nl2br($emailContent);

// Send email with the updated content
// (code for sending email not included here)
?&gt;