Feature #16034

Support for HTML in incoming mails

Added by Damian G over 3 years ago. Updated over 3 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Email receiving
Target version:-
Resolution:Duplicate

Description

Hi,
We are using CKEditor plugin.
We have problem with incoming mails as they are stripped down of html entities and converted into one single line with no respect to new lines (totally unreadable)

How can I reconfigure Redmine (mail_handler.rb?) so the incoming messages are not stripped down and pushed into database as (sanitizied?) HTML?

We have to tried to reconfigure the CKeditor plugin, make some changes to mail_handler.rb but with no luck.


Related issues

Duplicates Redmine - Feature #16962: Better handle html-only emails Closed

History

#1 Updated by Michael Steiner over 3 years ago

I have the same problem as you. Did you find a solution?

I am now using Redmine version 2.5.1 with Easy Redmine plugin 2014.rc01.03 on a windows server in production. The Easy Redmine plugin contains the CKeditor plugin.
And I have the same problem with fetching mails from IMAP server. The mails are stripped down of html entities and converted into one single line with no respect to new lines. So, no formatting is available. And additionally, the mail is not attached to the ticket as eml-file.

Before, I tested everything with Redmine version 2.4.3 with Easy Redmine plugin 2013.rc08.08 on a windows server. Here, everything worked fine. Mail body was inserted into a new comment of a ticket with formatting of the mail. And the mail was attached to the ticket as eml-file and stored in files folder.

Does anybody have an idea, how to solve the problem?

#2 Updated by Damian G over 3 years ago

Actually, I have found a workaround for this problem.

We use Redmine CRM helpdesk plugin, CKeditor is installed separately.

I wasn't able to change it on the level of the ckediotr plugin, so I decided to alter the mail handlers in a way that new lines are converted into <br />.

For the Redmine (mail_handler.rb) that would be two new lines after the:

#strip html tags and remove doctype directive
@plain_text_body = strip_tags(@plain_text_body.strip)
@plain_text_body.sub! %r{^<!DOCTYPE .*$}, '

    # fix for ckeditor
    @plain_text_body.gsub! %r{$}, "<br />" 
    @plain_text_body.gsub! %r{<br />\n<br />}, "<br />" 

It's not a beauty, but it works and the incoming mails are readable now.

I look forward to a better solution.

#3 Updated by Michael Steiner over 3 years ago

Thank you for the workaround.

I got another hint from Easy Redmine support. They told me that it is a problem with CKeditor. Now I am waiting for a patch.

#4 Updated by Damian G over 3 years ago

Actually, I think it is not a matter of problem with CKeditor, rather, it is a matter of hacking CKeditor a bit to make it compatible with Redmine :)

Please do share with us this patch of yours (if you get it and are willing to).

#5 Updated by Toshi MARUYAMA over 3 years ago

  • Status changed from New to Closed
  • Resolution set to Duplicate

Try #16962 patch.

#6 Updated by Toshi MARUYAMA over 3 years ago

Also available in: Atom PDF