Problem with Jira email handler - lots of whitespace


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
Accepted answer

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 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.

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.

No problem, thanks for the idea at least!

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.

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..


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
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,769 views 18 21
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you