In user.module, the user_mail() function is using a hard coded value to the line break string used in the message body. It is also specified to make changes in the code to customize it to your needs, which is not a good solution.
It would be perfect to have a variable in "settings.php" that defines the string to use instead. For example, let's call it $email_linebreak:
/**
* E-mail message body line break settings:
* - \r\n will work under dos and windows.
* - \n will work for linux, unix and BSDs.
* - \r will work for macs.
*/
$email_linebreak = "\n";
Then, in the user_mail() code, we should replace the "str_replace" function with a catch-all replacement using "preg_replace", having the following code in the end of the function:
global $email_linebreak;
return mail(
$mail,
mime_header_encode($subject),
preg_replace( '/\r\n|\n|\r/', $email_linebreak, $message),
"MIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8; format=flowed\nContent-transfer-encoding: 8Bit\n" . $header
);
I tried to use the code as is, but the $email_linebreak is not getting loaded for some reason, so I've hard coded the "\r\n" value instead. In any case, I'm just placing the idea here, so you can use it as a base for the definitive fix.
I hope I'm in the right direction.
Regards,
FredCK
Comments
Comment #1
Steven commentedBetter would be to do a survey on which linebreaks work on what systems.
The only one that has ever worked for me was "\n", and that was on Windows.
Comment #2
FredCK commentedMaybe this is a e-mail client program related issue. I had problems with Outlook 2003 and "\n". It worked well only with "\r\n".
A global solution would be even better... but, if nothing is available in this sense, let's make it configurable at least.
Comment #3
magico commentedMoving to get some attention, for discussion.
Comment #4
mdupontFixed in D6 and later. Closing.