Page 2 of 3

Re: Unable to create attachment with Email attribute = HTML

Posted: 01 May 2020, 12:20
by SL-Gundam
So the attachments are added correctly but we have 1 out of 2 where the attachments and notes are split into 2 parts.

It probably happened because your webserver took longer to process the request and the timestamps were too far apart for the note and the attachments to be merged

I have a solution for this: https://github.com/mantisbt-plugins/Ema ... 1602907c3d

Please test

Re: Unable to create attachment with Email attribute = HTML

Posted: 01 May 2020, 12:26
by SL-Gundam
If your webserver takes exceptionally long to process a request it's even possible that the note gets added but the attachment does not. This is because attachments are generally bigger and therefore require more processing power

Re: Unable to create attachment with Email attribute = HTML

Posted: 01 May 2020, 15:00
by sintaq
Thanks SL-Gundam

applying latest fixes on mail_api.php seems working after sending 2 emails. changelog also updated for future reference

core/mail_api.php
doc/CHANGELOG.txt

will continue with some regression and update accordingly. many thanks

Re: Unable to create attachment with Email attribute = HTML

Posted: 02 May 2020, 14:03
by sintaq
SL-Gundam,

Previous issue seemed OK. But now, new symptom observed. Looks the email cannot be parsed accordingly hence not able to create note with the latest reply. Refer attachments.

Re: Unable to create attachment with Email attribute = HTML

Posted: 03 May 2020, 03:49
by SL-Gundam
I think i've found the reason
Your mail client for test 1 and test 2 handle the from-sent-to-subject part a little bit differently (see below)
What mail client are you using?
The ** around it makes MantisBT show that text in bold. EmailReplyParser does not like that because it does not expect it.

We have 2 options.
1. Find out the idiosyncrasy in your mail client and see what we can do to deal with it
2. Turn off markdown support in MantisBT. EmailReporting will then convert HTML to plaintext instead of Markdown and therefore this will not be an issue

Code: Select all

Html on. Test 2. Reply email

 

**From:** Mohammad Zairi Othman
**Sent:** Saturday, 2 May, 2020 9:48 PM
**To:** ticket.mantis
**Subject:** RE: [## ITSM ## BAU Issues 2020 0002808]: Create ticket and note

 

Html on. Test 1. Reply email

 

\-----Original Message\-----
From: ticket.mantis@muamalat.com.my [mailto:ticket.mantis@muamalat.com.my]
Sent: Saturday, 2 May, 2020 9:47 PM
To: Mohammad Zairi Othman
Subject: [## ITSM ## BAU Issues 2020 0002808]: Create ticket and note

Re: Unable to create attachment with Email attribute = HTML

Posted: 03 May 2020, 03:57
by sintaq
Outlook 2010.

Let me try to find out the idiosyncrasy by trying other email client.

Re: Unable to create attachment with Email attribute = HTML

Posted: 04 May 2020, 05:57
by sintaq
Just to update, option 2 not an options because the result was messy. whole chunk of xmls were put in the note

Re: Unable to create attachment with Email attribute = HTML

Posted: 04 May 2020, 11:14
by SL-Gundam
If markdown is not a big requirement for you we can try to work on a better html -> plaintext conversion

Re: Unable to create attachment with Email attribute = HTML

Posted: 04 May 2020, 14:53
by sintaq
i'm ok with that. while at the same time, im suspecting this has to do with Exchange server and checking on it

Re: Unable to create attachment with Email attribute = HTML

Posted: 05 May 2020, 15:24
by SL-Gundam
If you are running on-premise Exchange it might be best to look at this:
https://www.mantisbt.org/wiki/doku.php/ ... parse_html

There is a note here for Exchange users and 2 links to Microsoft help.

Re: Unable to create attachment with Email attribute = HTML

Posted: 05 May 2020, 17:02
by sintaq
Thanks SL-Gundam. Will take a look

Any dirty code idea that I can apply to strip the ** sign at from-sent-to-subject?

Re: Unable to create attachment with Email attribute = HTML

Posted: 06 May 2020, 05:04
by sintaq
SL-Gundam,

Update:

These were my setup on the reply. However, not satisfactory. Refer attached

Html on
Markdown off
Imap html & alternative text
Debug on

Re: Unable to create attachment with Email attribute = HTML

Posted: 06 May 2020, 17:24
by sintaq
SL-Gundam

I think i understood the flow and reason for such behavior.

It was because, I'm replying to my own reply instead of replying to mantis's notification email. In mantis's notification, there's a string "-----Original Message-----" that I believed parser use to identify the start of a reply. Similar to mail_remove_replies_after, I guess

So wild idea for scenario "replying to mail/reply other than Mantis notification email", is there possibility for you to default/create default element in the array for " "-----Original Message-----"" on top for From element or something like that which I think by doing so, parser should be able to parser > create note accordingly.

This would benefit for environment that email is constantly use for communication while at the same time those email's communication would be capture accordingly in the respective mantis ticket by creating note accordingly.

just to my cent.

Re: Unable to create attachment with Email attribute = HTML

Posted: 07 May 2020, 09:42
by SL-Gundam
If you are running the latest 0.11.0-DEV EmailReplyParser should look for the "from" line and set that as the start of a reply.
It expects the from line to look like this: "From: NAME <EMAIL>"

Your from lines are only showing the name, no email address

"-----Original Message-----" are usually added only for plaintext emails. MantisBT notification are plaintext so any replies on those emails are usually in plaintext aswell

Re: Unable to create attachment with Email attribute = HTML

Posted: 09 May 2020, 03:52
by sintaq
SL- Gundam,

Thanks for your clarification. Finally, I'm able to get things working with last hiccup (so far) :lol:

Now, mantis able to parse the email correctly. however, it will re-add images pasted in previous email. flow like this,

1) send first html email with attachment and image pasted on it
2) send second html email with no attachment and image > mantis able able to parse 2nd email accordingly however when creating note, image from first email for added as well.