### Eclipse Workspace Patch 1.0
#P Limesurvey 1.x trunk stable
Index: admin/scripts/ckeditor.36/limesurvey-config.js
===================================================================
--- admin/scripts/ckeditor.36/limesurvey-config.js	(revision 10545)
+++ admin/scripts/ckeditor.36/limesurvey-config.js	(working copy)
@@ -70,4 +70,49 @@
 
    	config.extraPlugins = "limereplacementfields,ajax";
 
-};
\ No newline at end of file
+};
+
+/**
+ * CKEDITOR HTML writer configuration
+ *
+ * better html to text conversion (alternative text body 
+ *   for HTML emails)
+ *
+ * #05331
+ */
+CKEDITOR.on( 'instanceReady', function( ev )
+{
+	// only valid for email-message editors
+	if (! ev.editor.name.match(/^(email|message)_/)) return;
+	
+	var writer = ev.editor.dataProcessor.writer;
+	
+	writer.indentationChars = '';
+	
+	var tagsDouble = {'p': 1, 'h1':1, 'h2':1, 'h3':1, 'h4':1, 'h5':1, 'h6':1};
+	var tagsBlank = CKEDITOR.tools.extend( {}, CKEDITOR.dtd.$nonBodyContent);
+	
+	for ( var e in tagsDouble )
+	{
+		writer.setRules( e,
+		{
+			indent : 0,
+			breakBeforeOpen : 0,
+			breakAfterOpen : 0,
+			breakBeforeClose : 1,
+			breakAfterClose : 1
+		});
+	}
+	
+	for ( var e in tagsBlank )
+	{
+		writer.setRules( e,
+		{
+			indent : 0,
+			breakBeforeOpen : 0,
+			breakAfterOpen : 0,
+			breakBeforeClose : 0,
+			breakAfterClose : 0
+		});
+	}
+});
\ No newline at end of file
Index: common_functions.php
===================================================================
--- common_functions.php	(revision 10545)
+++ common_functions.php	(working copy)
@@ -4304,7 +4304,7 @@
     if ($ishtml) {
         $mail->IsHTML(true);
     	$mail->Body = $body;
-        $mail->AltBody = strip_tags(br2nl(html_entity_decode($body,ENT_QUOTES,'UTF-8')));
+        $mail->AltBody = strip_tags(html_entity_decode($body,ENT_QUOTES,'UTF-8'));
     } else
        {
         $mail->IsHTML(false);
