I am using Drupals built-in mail function.

When sending nodes in plain text, the function call to simplenews_html_to_text() causes line breaks to be removed. This means text is clustered and paragraphs are merged.

By commenting out the function call at line 1574 in simplenews.module (http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/simplenews/...) the plain text messages were sent and received as intended.

Comments

sutharsan’s picture

please be more specific. Provide samples of text before and after replacement.
I suspect this is about replacement of <br /> tags. This is performed by drupal_html_to_text().

Danial Namousi’s picture

Status: Active » Postponed (maintainer needs more info)

I can't reproduce this behavior at the moment but I'll try to explain the scenario and hope that helps.

If a message was entered as plain text without any HTML and using simple \n-linebreaks, those linebreaks would be removed from the final output by the time it reached the recipient. To me, it seemed like this was bad behavor so I tried locating where the message could possibly be distorted and found the above-mentioned line to be the 'problem'.

Due to time constraints, I couldn't dig any deeper into this and had to settle with disabling the function call since I didn't intend to input any HTML.

The problem is that drupal_html_to_text doesn't preserve linebreaks and if plain text output is required, simplenews_html_to_text is called regardless of whether the input contains any HTML or not.

So basically, one has to actually input HTML-breaks so they can be turned into\n.

Danial Namousi’s picture

Here's an example. I select 'Message plain text' and input filter, enter the following in a textarea (without an editor):

This is my first paragraph. I will now press Enter twice so i can start the next paragraph.

I have reached my destination; the second paragraph.

And this is what I get:

This is my first paragraph. I will now press Enter twice so i can start the  
next paragraph. I have reached my destination; the second paragraph.
sutharsan’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

I can't reproduce this either and therefore can not debug it. Closing the issue. Feel free to re-open if you have a way to reproduce the error.

Anonymous’s picture

I encountered the same problem. It seems to be a problem with the input format.

I had to make sure to run the input through a "Line break converter" after the "HTML filter" for Drupal to add HTML line breaks.

Else, the resulting mails won't contain any line breaks.

To reproduce this, make sure to use an input format with the HTML filter set to remove all HTML formatting and do not use any additional filters so the resulting output is just plain text without any HTML formatting.