My customers have been heavily using the personal contact forms on my site. I am getting a lot of complaints that all of their return characters are getting stripped from their messages. I believe it might be related to this:
http://drupal.org/node/298708
which leads me to believe it may be a call to drupal_html_to_text() by drupal mail. Could it be that it is assuming that the message field is html when it is not?

I've tried to address the problem by adding a wysiwyg editor to the message field. I did this by using hook_form_alter, changing the message type from 'textarea' to 'text_format':

function _form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'contact_personal_form') {
$form['message']['#type']='text_format';
}
}

This made text editor (tinymce) appear in the message field, but gave this error when the message was sent:

Notice: Array to string conversion in HTMLMailSystem->format() (line 49 of <mypath>/sites/all/modules/htmlmail/htmlmail.mail.inc).

I would really appreciate any pointers on how to allow users to send contact messages without all whitespace/newlines being stripped away.

Kari

Comments

dave reid’s picture

Project: Drupal core » HTML Mail
Version: 7.20 » 7.x-2.x-dev
Component: contact.module » Code

You'd have to run this by the HTMLMail issue queue.

icicleking’s picture

Issue summary: View changes
StatusFileSize
new548 bytes

I'm testing this patch with a similar situation. However, there are so many if..else statements in the file I can't be sure if it addresses you're situation exactly. The long and short is the htmlmail form() function sets the Content Type Header to text/plain;charset=UTF-8, not text/plain;charset=UTF-8;format=flowed;delsp=yes;, which allows the plane text email to flow properly line to line.

icicleking’s picture

StatusFileSize
new764 bytes

Updated patch.

salvis’s picture

Wow, thank you for the patch icicleking!

However, after 5 years with no further complaints this doesn't seem to be a common issue, and committing this patch might do more harm than good.

Is it still an issue in D8? What does D8 do?

icicleking’s picture

I posted my patch more as a possible solution for people with a similar issue. I have no problem closing the issue, of course it wasn't mine in the first place. The message for yee future Drupalers is that patch is not fully tested, and honestly I'm messing with a system I don't know a ton about (email)... so caveat emptor.

salvis’s picture

I don't want to close the issue — it makes sense to have the patch available.

Thanks, icicleking!