How can the use of external stylesheets in HTML emails affect their display on different email clients, especially on smartphones?

Using external stylesheets in HTML emails can cause display issues on different email clients, especially on smartphones, because some email clients may not support external stylesheets or may block them for security reasons. To ensure consistent display across different email clients, it is recommended to use inline styles instead of external stylesheets in HTML emails.

// Example of using inline styles in HTML email
$to = 'recipient@example.com';
$subject = 'HTML Email with Inline Styles';
$message = '
<html>
<head>
<title>HTML Email with Inline Styles</title>
</head>
<body>
<div style="color: #333; font-size: 16px; font-family: Arial, sans-serif;">
<p>This is an example of an HTML email with inline styles.</p>
<p style="color: #f00; font-weight: bold;">This text is styled inline.</p>
</div>
</body>
</html>
';

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

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