login about faq

Hi Guys,

I've got a weird one here. I connect to a user's mailbox, iterate through each folder and ask for the number of items in each folder using NumMessages...but it's proving to be 'temperamental'. For several folders it returns 0 when there are definitely emails in the folder. No errors are getting generated when I connect to the mailbox (or folder) and, as far as I can tell, nothing is blowing up or causing any exceptions (I check after connecting to each folder). I'm running v9.5.0.47 of the IMAP controls and this is against a Gmail mailbox.

Not sure whether it's connected or not but some folders where I have found emails (i.e. NumMessages returned the correct number), when I delete those emails (by using the SetMailFlag method to set the Deleted flag for each email and then calling ExpungeAndClose method) they don't get deleted. Again, no errors are being generated or exceptions thrown and the methods are returning 'success'.

This is all code that has been working fine in the past and has been tested against Gmail, Office365 and Exchange without any problems.

Any ideas?

asked Feb 13 '15 at 07:46

TheNeil's gravatar image

TheNeil
527


Set the Imap.KeepSessionLog property = true, then examine the contents of the Imap.SessionLog property after the method calls and property accesses of interest have been called..

In other words -- look to see what transpired.. :)

link

answered Feb 13 '15 at 09:06

chilkat's gravatar image

chilkat ♦♦
11.8k316358421

Very strange as I added that to my code (really useful BTW - I didn't know the controls could do that) and it revealed that everything was OK when it came to the NumMessages and deleting emails and both now seem to be working.

The only difference that I can find is that the user who was having problems took the afternoon off. Nothing too strange in that except that he uses Google's sync tools to connect Outlook to his GMail account. Could that be causing problems?

link

answered Feb 13 '15 at 11:16

TheNeil's gravatar image

TheNeil
527

I've dug into this and the problem does look to be Google's sync tools - emails are showing in Outlook which aren't on the Gmail server (e.g. going via Gmail rather than Outlook). This explains why Chilkat is returning different email counts to what the user in question is seeing.

No idea what the long-term solution is but, hopefully, this'll save anyone else banging their head against it.

link

answered Feb 16 '15 at 04:42

TheNeil's gravatar image

TheNeil
527

link

answered Feb 16 '15 at 08:51

chilkat's gravatar image

chilkat ♦♦
11.8k316358421

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×175

Asked: Feb 13 '15 at 07:46

Seen: 807 times

Last updated: Feb 16 '15 at 08:51

powered by OSQA