Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error - Bad Message Number #116

Closed
andrewhenke opened this issue Jan 23, 2024 · 11 comments
Closed

Error - Bad Message Number #116

andrewhenke opened this issue Jan 23, 2024 · 11 comments

Comments

@andrewhenke
Copy link

When I run the fetch_reports utility from the command line, I frequently encounter the following error nearly every single time I fetch the latest reports.

dmarc-srg [error]: ErrorException: imap_fetchstructure(): Bad message number in <REMOVED FOR PRIVACY>/classes/Mail/MailMessage.php:98
Stack trace:
#0 [internal function]: {closure}()
#1 <REMOVED FOR PRIVACY>/classes/Mail/MailMessage.php(98): imap_fetchstructure()
#2 <REMOVED FOR PRIVACY>/classes/Mail/MailMessage.php(71): Liuch\DmarcSrg\Mail\MailMessage->ensureAttachment()
#3 <REMOVED FOR PRIVACY>/classes/Sources/MailboxSource.php(83): Liuch\DmarcSrg\Mail\MailMessage->validate()
#4 <REMOVED FOR PRIVACY>/classes/Report/ReportFetcher.php(121): Liuch\DmarcSrg\Sources\MailboxSource->current()
#5 <REMOVED FOR PRIVACY>/utils/fetch_reports.php(174): Liuch\DmarcSrg\Report\ReportFetcher->fetch()
#6 {main}
-----
Error: imap_fetchstructure(): Bad message number (-1)
-----
ErrorException: imap_fetchstructure(): Bad message number in <REMOVED FOR PRIVACY>/classes/Mail/MailMessage.php:98
Stack trace:
#0 [internal function]: {closure}()
#1 <REMOVED FOR PRIVACY>/classes/Mail/MailMessage.php(98): imap_fetchstructure()
#2 <REMOVED FOR PRIVACY>/classes/Mail/MailMessage.php(71): Liuch\DmarcSrg\Mail\MailMessage->ensureAttachment()
#3 <REMOVED FOR PRIVACY>/classes/Sources/MailboxSource.php(83): Liuch\DmarcSrg\Mail\MailMessage->validate()
#4 <REMOVED FOR PRIVACY>/classes/Report/ReportFetcher.php(121): Liuch\DmarcSrg\Sources\MailboxSource->current()
#5 <REMOVED FOR PRIVACY>/utils/fetch_reports.php(174): Liuch\DmarcSrg\Report\ReportFetcher->fetch()
#6 {main}

Please let me know if I can provide any additional information or details!

@liuch
Copy link
Owner

liuch commented Jan 23, 2024

Hello,
Could you show me the $fetcher => mailboxes section from your configuration file?

@andrewhenke
Copy link
Author

image

@liuch
Copy link
Owner

liuch commented Jan 24, 2024

Thank you for the information. I have a pair more questions:

  • Is it possible that when this error occurs there were other IMAP sessions where messages were deleted or moved from the mailbox?
  • When this error occurs are there any unprocessed mail messages left? If yes, are they correct incoming dmarc reports?

@bend86
Copy link

bend86 commented Feb 12, 2024

Dear,

I add the same problem. I fixed it by working on messages UID instead of sequencial id. (UID order does not change whatever happens).

Adding flags FT_UID, CP_UID, ST_UID to following calls is working for me.

image

@andrewhenke
Copy link
Author

Thank you for the information. I have a pair more questions:

  • Is it possible that when this error occurs there were other IMAP sessions where messages were deleted or moved from the mailbox?

  • When this error occurs are there any unprocessed mail messages left? If yes, are they correct incoming dmarc reports?

Hello, and my apologies for the delay in response.

The imap connection I utilize is only for accessing the DMARC reports and no other connections would be present.

Likewise, yes, there are outstanding reports to be ingested and they are properly formatted.

@bend86
Copy link

bend86 commented Feb 13, 2024

Dear, for me there was only dmarc reports in the mailbox, unprocessed. Nothing else.
It failed systematically, after a few messages parsed (3-4).
For information: i use a gmail mailbox

The fix by use of UID let me think there could be some shift in the message index when some operations are done.

Hope it helps

@liuch
Copy link
Owner

liuch commented Feb 14, 2024

Thank you all. It looks like some email servers don't follow the standard. I'll fix it soon.

@liuch
Copy link
Owner

liuch commented Feb 15, 2024

done.

@andrewhenke
Copy link
Author

I'll give it a test it the morning and let you know how it functions for me!

@liuch
Copy link
Owner

liuch commented Mar 5, 2024

Any news on this issue? May I close this?

@liuch
Copy link
Owner

liuch commented Mar 29, 2024

I'm closing this then. Feel free to reopen it if the issue is still relevant.

@liuch liuch closed this as completed Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants