Page 1 of 1

One mail, two bugs reported

Posted: 23 Jan 2019, 17:33
by jcgallardo
Mantis 2.18.0
EmailReporting 0.10.1

I have configured a IMAP Folder in an Office 365 mailbox. We have configured email reporting to not to delete the emails procesed.

I received an email three weeks ago, and when I put it in autoreporting folder, email reporting added this mail as a new incident with id-bug-number 87000. We resolved the incident and close the bug, but we didn't delete the email from the autoreporting folder.

Today we see that Emailreporting had procesed the mail again and create a new incident with id-bug-number 88000.

I have reviewed the 'mantis_plugin_emailreporting_msgids_table' and I surprised to see that the old bug (id-87000) didn't have a msg_id, and the new bug (id-88000) had the msg_id that corresponding to the email.

How is it possible? Is a bug or a user action?


P.D: Email reporting didnĀ“t associate the bugs.

Re: One mail, two bugs reported

Posted: 23 Jan 2019, 22:17
by SL-Gundam
IMAP works differently from POP3 when it concerns the deletion of emails: Please read this: http://www.mantisbt.org/wiki/doku.php/m ... ilbox_type

IMAP towards Exchange has always been an issue because of an incomplete IMAP4rev1 implementation on the exchange side. EmailReporting 0.9.x and 0.10.x fixed a lot of issues with Exchange but as you've noticed it is not perfect

If issues are deleted from MantisBT, the references are also deleted from mantis_plugin_emailreporting_msgids_table
Are you triggering EmailReporting manually to import emails or does it happen on a schedule?

Re: One mail, two bugs reported

Posted: 14 Feb 2019, 11:57
by jcgallardo
Thanks for your answer.

I have configured a scheduled task to run every 2 minutes. If the task is running, we doesnt launch a new instance task.

We don't delete bugs, we only close it.

I have a XAMPP instalacion on Windows Server 2012, the Mantis version is 2.18.0 and the emailreporting is version 0.10. Some month ago, we have Mantis version 1.3 and emailreporting version 0.9 and never had this problem.

Do you know what can we do to resolve it?

Re: One mail, two bugs reported

Posted: 14 Feb 2019, 18:36
by SL-Gundam
What might have happened is that EmailReporting did not fully run to completion.
If EmailReporting encounters a fatal error before fully finishing the mailbox, emails are not deleted/marked as read.

We've recently found an issue with reference id parsing.
https://github.com/mantisbt-plugins/Ema ... 5bb7939d35

Please update to 0.11.0-DEV and see if that works better

Re: One mail, two bugs reported

Posted: 15 Mar 2019, 15:21
by jcgallardo
I have added some points of log the proccess and I think the problem is on this point of process_imap_mailbox function (see attach) but I can't know how can I have to resolve it.

In this case, I have an email that was registered in Mantis ten days before (id=90323) and during ten days the program didn't register the incident again.

Yesterday I saw that the plugin had reported the same email with another id bug (id=90765) and had added a relationship with the first id bug.

Can you help me?

Re: One mail, two bugs reported

Posted: 15 Mar 2019, 17:03
by SL-Gundam
Because of your code modifications the line numbers don't add up

Please provide your modified mail_api.php

Re: One mail, two bugs reported

Posted: 20 Mar 2019, 15:32
by jcgallardo
Thanks. Here is my modified mail_api.php

Re: One mail, two bugs reported

Posted: 20 Mar 2019, 17:34
by SL-Gundam
You are right concerning the line where it goes wrong.

As i understand it, the folder in the mailbox contains quite a lot of old, already processed, emails. So EmailReporting makes a lot of flag checks to see whether they are marked as deleted/processed.

It might be that Office365 does not like that. I'm gonna look into caching the results

Re: One mail, two bugs reported

Posted: 20 Mar 2019, 18:06
by SL-Gundam
Made some changes
https://github.com/mantisbt-plugins/Ema ... 404d2ae56b

Hopefully this works better for you

Re: One mail, two bugs reported

Posted: 25 Mar 2019, 16:07
by jcgallardo
I tried with your changes and the scheduled task didn't run (I have any record in mantis.log).

I have turned the version back and checked the logs. I have seen that in PHP log there is this error that repeated every two minutes during the time I have the new version.

[25-Mar-2019 16:39:27 Europe/Berlin] PHP Fatal error: Cannot use isset() on the result of an expression (you can use "null !== expression" instead) in D:\xampp\htdocs\mantis\plugins\EmailReporting\core\mail_api.php on line 684

The line 684 belons to the isDeleted function and is one of the modified lines.

I have checked all modified lines and I can see where is the error.

Can you help me? I attached the modified files and a Image with php error log.

Thanks in advance

P.D: I tried with ( null !== EXPRESSION ) and, in the first time, the system registered every mails that I have in the imap folder as new bugs and in the rest of the times, it registered as new notes in the same bug.

Re: One mail, two bugs reported

Posted: 25 Mar 2019, 17:14
by SL-Gundam
You modified your code incorrectly.
The dollar signs are missing on multiple lines for $p_flags

I suggest you go here https://github.com/mantisbt-plugins/EmailReporting and click the "clone or download" button and click on "download zip"

use that to overwrite all existing files

Re: One mail, two bugs reported

Posted: 26 Mar 2019, 16:14
by jcgallardo
Fu**! Fu**! Fu**! What a shame! I checked it several times and I did not see it. Apologies.

I have changed all the files as you indicated and it is working correctly and the time to check the mailboxes has decreased significantly.

Thank you again for your support and patience.

Re: One mail, two bugs reported

Posted: 26 Mar 2019, 18:32
by SL-Gundam
Very good that the problem is resolved. Even better that we also see a nice performance improvement :D

Re: One mail, two bugs reported

Posted: 18 Apr 2019, 09:35
by SL-Gundam
In case your interested

Another user contacted us through the MantisBT issue tracker with performance problems
https://www.mantisbt.org/bugs/view.php?id=25701

This resulted in a change that again improved performance significantly
https://github.com/mantisbt-plugins/Ema ... 6c8490d09e