Problem with Jira email handler - lots of whitespace

MarkoR February 21, 2013

Hello,

I am having difficulties with whitespace in new jira issues and comments coming from MS exchange 2007. For each new line i have two new lines in jira description field. MIME format for my pop mailbox is HtmlAndTextAlternative and i do not want to set it to text since users are inserting screenshots of bugs in email body..

Now, i cannot tell my users to start using plain text instead of html, so i would like to use regexp to remove that white space... Can you please advise how to do this? I already tried with ccc-ezgooeymh and emailhandler plugins but damn thing is immune to those... What should be regex syntax for default jira email handler?

Thank you in advance, kind regards.

1 answer

1 accepted

1 vote
Answer accepted
Andy Brook [Plugin People]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 21, 2013

The default mail handler converts HTML to text in a best effort way, retaining formatting from HTML to plain text (even wiki markup) is quite tricky. The Whitespace can come from extraneous </p> tags that are converted to newlines which is I think what you are seeing.

When email clients send mail, they can send a text/plain multipart/alternative component which is the same 'text' entered but in plain text not HTML. Windohs Exchange adminstrators can set a policy to default people to _not_ include this (in their eyes this could be seen as redundant duplicated information adding to network loading). If you are in this boat, then you are in a HTML -> Text conversion scenario with no way out.

JEMH has a few extra tweaks in the HTML -> Text conversion route (different parsers that can result in a cleaner output in some cases), have you tried that?

If there is a partcicular email that is causing difficulty, I would be happy to review to see how I can deal with it. Mails directed to jemhtesting@gmail.com can be picked up for testing. If it doesnt support this content fixup, Im pretty sure I can add it.

What JIRA version are you targetting?

JEMH already has a feature for doing exactly that with the Subject, I've just added the same thing for the Body, you can test it out in 1.3.2 that I'll release later today.

And finally, I notice that JIRA 5.2.5 at least seems to compress additional whitespace in issue descriptions down when you view them, not so sure about notifications.

MarkoR February 24, 2013

Dear Andy,

I have sent test email, could you please check. I am using jira 4.2.4 and unfortunately i can not upgrade. I did not try with jemh, i was checking only free solutions. Sorry, i think your product is great, but i just don’t have any budget for jira.

Looking forward for handler results.


Thanks, kind regards.

Andy Brook [Plugin People]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 24, 2013

No problem, thanks for the idea at least!

Andy Brook [Plugin People]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 24, 2013

To clarify, this feature is added to JEMH 1.3.2, but is not usable on JIRA 4.2.4 - I'm afraid I dont develop against 4.x anymore.

MarkoR February 24, 2013

Dear Andy,

What about my test email? Do you also have lot of whitespace in description field ? I was thinking to just change MIME format on this pop3 account to text..

Regards

Andy Brook [Plugin People]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 24, 2013

Ah ok, so that email contains text/html and text/plain. No it looked fine, as JEMH prefers text/plain, just as JIRA does (the text/plain component is what I would call 'clean').

Whilst your testcase contains both parts, other users may not necesarily configure their clients to send both. If they only send HTML you have no choice, and must 'deal with it' (or not). As the content is provided by the remote client, Im not sure any MIME settings on your POP will help.

The JEMH features I mentioned earlier deal with the HTML only scenario, which is probably what you are faced with.

Suggest an answer

Log in or Sign up to answer