Opened 7 years ago
Closed 6 years ago
#1438476 closed Bugs (fixed)
Extra Linefeeds in Message Body
| Reported by: | nobody | Owned by: | nobody |
|---|---|---|---|
| Priority: | 5 | Milestone: | 0.1-rc1 |
| Component: | PHP backend | Version: | None |
| Severity: | minor | Keywords: | |
| Cc: |
Description (last modified by thomasb)
I was very glad to see that the post-v0.1-beta patches fixed the "extra
linefeeds in the headers" problem. However, the v0.1-beta seems to have
introduced a new problem with extra linefeeds in the message body.
I've seen some discussion of this in the dev mailing lists related to
receiving mail in Outlook 2003, but I'm seeing the same issue with GMail
(which isn't a big surprise since that's where I was experiencing the
header problems to).
If you're using PHP's mail(), in any message sent to GMail accounts, an
extra linefeed is inserted wherever the sender has put a hard return.
So this:
abcde
abcde
abcde
Becomes this:
abcde
abcde
abcde
Change History (7)
comment:1 Changed 7 years ago by arcnet_nl
comment:2 Changed 7 years ago by spider_007
Logged In: YES user_id=860043 doesn't the php-mail function automatically convert '\n' to '\r\n'? Are you on a Linux, or Windows server? Also, isn't this a client-side issue if GMail doubles the number of returns; while Outlook removes them?
comment:3 Changed 7 years ago by nobody
Logged In: NO spider_007, sorry for the delay in getting back to you. I'm on a FreeBSD server. And, no, it isn't a client-side issue because the extra linefeeds are there whether you use the GMail web interface or pull down the messages via POP3. I'm not exactly sure why RoundCube (especially in combination with GMail) has these linefeed issues when every other web app I have that uses the mail() function doesn't.
comment:4 Changed 7 years ago by grettir
Logged In: YES
user_id=1478561
Solved it by changing the following in sendmail.inc:
// fetch message body
$message_body = get_input_value('_message', RCUBE_INPUT_POST, TRUE,
$message_charset);
...to:
// fetch message body
$orig_body = get_input_value('_message', RCUBE_INPUT_POST, TRUE,
$message_charset);
$message_body = str_replace( "\r\n", "\n", $orig_body);
I'm no programmer, so that's probably as ugly as sin, but it does solve the
problem...
comment:5 Changed 7 years ago by thomasb
- Component changed from Client to PHP backend
- Description modified (diff)
- Milestone changed from 0.1-beta2 to 0.1rc1
- Owner changed from roundcube to nobody
- Severity changed from critical to minor
- Status changed from assigned to new
comment:6 Changed 6 years ago by seansan
Found this in the PHP mail function:
subject: Subject of the email to be sent.
This must not contain any newline characters, or the mail may not be sent properly.
message: Message to be sent.
Each line should be separated with a LF (\n). Lines should not be larger than 70 characters.
Be aware! (Windows only) When PHP is talking to a SMTP server directly, if a full stop is found on the start of a line, it is removed. To counter-act this, replace these occurrences with a double dot. <?php $text = str_replace("\n.", "\n..", $text); ?>
Interesting discussion on : http://nl2.php.net/manual/nl/function.mail.php
Maybe it is system and SMTP or mail() dependent
Maybe
comment:7 Changed 6 years ago by thomasb
- Resolution changed from None to fixed
- Status changed from new to closed
RoundCube has now a system detection which automatically selects the right line separator. There's a config parameter to set it manually.
