As you correctly said, we can adjust $conf['mail_line_endings'] in settings.php, because the $message['body'] uses "$line_endings"
$line_endings = variable_get('mail_line_endings', MAIL_LINE_ENDINGS);
$mail_body = preg_replace('@\r?\n@', $line_endings, $message['body']);
But, i might be mistaken, but i still need to apply the patch, because in the file "/includes/mail.inc"
there is this line (line 10):
define('MAIL_LINE_ENDINGS', isset($_SERVER['WINDIR']) || (isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'], 'Win32') !== FALSE) ? "\r\n" : "\n");
that re-defines the MAIL_LINE_ENDINGS constant, setting it to "\n" (i'm on linux - AlmaLinux 8.x)
After the Drupal 7.103 core update, i'm still experiencing a problem with outgoing e-mails using drupal_mail() function.
This is how a 3 rows html test mail body is shown in all the e-mail clients that the receiver uses (including gmail webmail).
This is a multi-part message in MIME format.
--0239714e6c488a2e4f394263b8f561e40c281d241
Content-Type: multipart/alternative;
boundary="d736db4fc82e3e0f3789544c5fca10674e03b1370"
Content-Transfer-Encoding: 8bit
--d736db4fc82e3e0f3789544c5fca10674e03b1370
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
Questa รจ la prima riga.
Questa รจ la seconda riga.
Questa รจ la terza riga.
--d736db4fc82e3e0f3789544c5fca10674e03b1370
Content-Type: text/html; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8Bit
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body id="mimemail-body" class="dmail-smtp-dmail-invio-diretto-html">
<div id="center">
<div id="main">
<p style="color: #ff5733; font-size: 20px; margin-bottom: 10px;">Questa รจ la prima riga.</p>
<p style="color: #33c3ff; font-size: 18px; margin-bottom: 10px;">Questa รจ la seconda riga.</p>
<p style="color: #28a745; font-size: 16px; font-style: italic;">Questa รจ la terza riga.</p></div>
</div>
</body>
</html>
--d736db4fc82e3e0f3789544c5fca10674e03b1370--
--0239714e6c488a2e4f394263b8f561e40c281d241--
I'm using PHP 8.3 on Almalinux 8.x.
In my Drupal conf, Mail System is set to use Site-wide default MailSystemInterface class => "MimeMailSystem".
I fixed this problem with the attached patch
Hope it may help others with the same problem
Pentium โ created an issue.