Email Reporting not picking up all the emails in a folder

This plugin allows you to report an issue in MantisBT by sending an email to a particular mail account

Moderators: Developer, Contributor

Post Reply
ash.raghav
Posts: 10
Joined: 03 Sep 2017, 23:26

Email Reporting not picking up all the emails in a folder

Post by ash.raghav »

Hi,

I have deleted my previous Mantis installation and reinstalled fresh as my prior installation was a little messy and disorganised.

After I reinstalled and ran the Email Reporting plugin, it is clearly picking up only those emails which was not imported into Mantis previously. It clearly looks like there is something set somewhere to disallow import of what was previously imported.

However, I am now unable to get any my previous emails imported into Mantis.

Has anyone else faced the same problem? any tips on how to clear cache or index using which the Email reporting plugin might be picking up from?

Thanks
SL-Gundam
Posts: 722
Joined: 06 Jul 2011, 14:17

Re: Email Reporting not picking up all the emails in a folde

Post by SL-Gundam »

If you want EmailReporting to pick up emails that have already been imported previously by EmailReporting, do the following

POP3: mark the emails in question as unread in your mail client
IMAP: emails are marked as deleted but not purged. Undelete said emails

Documentation: https://www.mantisbt.org/wiki/doku.php/ ... ilbox_type

That should make EmailReporting process those emails again.
ash.raghav
Posts: 10
Joined: 03 Sep 2017, 23:26

Re: Email Reporting not picking up all the emails in a folde

Post by ash.raghav »

Thanks SL-Gundam.

The emails are in the same folder as they were previously when I had imported them in Mantis. None of them were deleted from my mailbox because I have disabled the option to delete emails after they were processed by Email Reporting

I am sorry but where are they marked as "deleted"? I am using IMAP and Gmail and none of the emails are marked as "deleted" or "archived" for that matter which is why I am slightly confused.

So technically there are no emails for me to un-delete. And IMAP Auto-Expunge settings is off now as per previous suggestion. Any other suggestions? Thanks again

P.S. I am wondering where this bit of validation exists in the package - IMAP: emails are marked as deleted but not purged. Undelete said emails?
SL-Gundam
Posts: 722
Joined: 06 Jul 2011, 14:17

Re: Email Reporting not picking up all the emails in a folde

Post by SL-Gundam »

Check for deleted flag starts here: https://github.com/mantisbt-plugins/Ema ... i.php#L446
Check for expunge starts here: https://github.com/mantisbt-plugins/Ema ... i.php#L496

I checked gmail and expect you will find a label (probably "Trash") connected to those emails. Delete that label
Gmail is a special case concerning IMAP since they need to support legacy with IMAP but the web interface they provide works differently which creates some unexpected situations sometimes
ash.raghav
Posts: 10
Joined: 03 Sep 2017, 23:26

Re: Email Reporting not picking up all the emails in a folde

Post by ash.raghav »

Thanks SL-Gundam. I think I have a complicated situation here.

If you remember - viewtopic.php?f=13&t=24946. This is where you had advised me to turn off Auto-Expunge and prior to this, any labels I had assigned where automatically removed (owing to Auto-Expunge settings). My Auto-Expunge settings was then to simply "Archive the message" (Not move to the Bin nor delete immediately from the server). This means, there was no other label (e.g. Trash, Junk, Archive, etc) attached to any of my messages present in the IMAP folders.

After turning off Auto-Expunge, I managed to re-label all my conversations again and now all my previously imported conversations (through Email Reporting) are in the correct labels. The labels I now see are only "Inbox" and the custom label I have based on filters.

Even after putting them back into the right labels, Email Reporting has not managed to pick them up. Not sure what else I can do at this point :-(

Thanks for your time and suggestions. Much appreciated !
ash.raghav
Posts: 10
Joined: 03 Sep 2017, 23:26

Re: Email Reporting not picking up all the emails in a folde

Post by ash.raghav »

I had to resort to end up doing the dirty way temporarily to import all the previous emails by settings "$t_isDeleted = FALSE;" to allow processing every single email in IMAP folders.

I am happy with this option given that all my emails will now be imported and I have turned-off Auto-Expunge which means my emails will not be Archived nor the labels will be removed.

I can happily go back to Mantis and update the emails accordingly.

One last question - when the Email Reporting plugin runs, is it possible to pick the conversation date of an email and update the same as the "Last Modified" column in Mantis? Currently, the last modified date is date on which the Email Reporting tool had imported the conversation.

Many thanks again! :-)
SL-Gundam
Posts: 722
Joined: 06 Jul 2011, 14:17

Re: Email Reporting not picking up all the emails in a folde

Post by SL-Gundam »

Good quickfix. Nice job

Currently EmailReporting does not support updating the modification date of an issue. You could of course make custom modifications to EmailReporting to support this but the easiest might be to just run the import job every minute so that the difference between the email being processed and the conversation date is up to one minute
ash.raghav
Posts: 10
Joined: 03 Sep 2017, 23:26

Re: Email Reporting not picking up all the emails in a folde

Post by ash.raghav »

Thanks SL-Gundam. Just thought that it is easier to sort this way than trying to find what Gmail has done its bowels.

Well, running the import job every minute will not be optimal in my case as I don't want to give my server a run. So have set it to every hour.

The main reason why I wanted to customise the reporting/modified date is in cases where I am importing everything in bulk like now. It helps maintain the audit trail.

However, I wouldn't worry about them going forward because the emails will show a difference of an hour which is not a big deal at all.

Many Thanks for all your help! Great product and support!
Ancy
Posts: 46
Joined: 30 Jun 2017, 11:10

Re: Email Reporting not picking up all the emails in a folde

Post by Ancy »

Hi Both, As i am not good in this, could you please explain what line has to be added where to import the emails again from the same mailbox folder?
Thanks in advance,
Ancy
SL-Gundam
Posts: 722
Joined: 06 Jul 2011, 14:17

Re: Email Reporting not picking up all the emails in a folde

Post by SL-Gundam »

He added

Code: Select all

$t_isDeleted = FALSE;
on line 452 in mail_api.php

Don't forget to remove this added code after processing previous emails
Ancy
Posts: 46
Joined: 30 Jun 2017, 11:10

Re: Email Reporting not picking up all the emails in a folde

Post by Ancy »

Yes, it worked . i did like this
mantis/plugins/EmailReporting/core/mail_api.php
if ( $t_isDeleted === FALSE )
{
// Email marked as deleted. Do nothing
}
Post Reply