Mark Williams 14 Posted January 12, 2021 I am trying to retrieve the contents of my gmail using TIDPop3 as a test. I can connect, login fine. I then use CheckMessages to find out how many emails there are. It tells me there are 274. However, my Gmail Inbox believes there are over 1500 and my All Mail box tells me there are over 7500. I download the headers using following: Count:=CheckMessages; for i := 1 to count do begin IDMessage1.Clear; RetrieveHeader(i, IDMessage1); ListBox1.Items.Add(IDMessage1.From.Address+' '+IDMessage1.Subject+' '+DateTimeToStr(IDmessage1.Date)); end; It is starting (almost) with the oldest emails and then proceeding forwards to the most recent. However, the first email it retrieves is not the oldest. It skips a handful. Then it gets a small batch, skips some more and then produces a larger batch. It all seems a bit random. Are there any obvious reasons why CheckMessages is reporting only a small portion of the actual emails and also why RetrieveHeader may be skipping batches? Out if interest, I tried RetrieveHeader outside the range of CheckMessages, but well within the true email count and (unsurprisingly) it threw up a range error. Share this post Link to post
Angus Robertson 574 Posted January 12, 2021 Add recent: to the start of the account user name, no spaces. Angus Share this post Link to post
Remy Lebeau 1396 Posted January 12, 2021 1 hour ago, Mark Williams said: I am trying to retrieve the contents of my gmail using TIDPop3 as a test. Why POP3 and not IMAP? GMail's POP3 implementation is a bit of an oddball, it does not exhibit standard POP3 behaviors. This is described in GMail's POP3 documentation. This is why I question your choice to use POP3 to begin with. 1 hour ago, Mark Williams said: I then use CheckMessages to find out how many emails there are. It tells me there are 274. More precisely, it tells you that you have 274 emails that have not been downloaded via POP3 yet. 1 hour ago, Mark Williams said: However, my Gmail Inbox believes there are over 1500 and my All Mail box tells me there are over 7500. Once you have downloaded a Gmail email via POP3, you can't access it again via POP3, even if it still exists in the Inbox. In your Gmail settings, you have to specify what you want Gmail to do with emails that have been downloaded via PO3. 1 Share this post Link to post
Mark Williams 14 Posted January 12, 2021 2 hours ago, Remy Lebeau said: Why POP3 and not IMAP? Sorry to have to say "ignorance"! Didn't know there was an INDY IMAP client. Thanks for pointing in the right direction. Have abandoned Pop3. Share this post Link to post
Remy Lebeau 1396 Posted January 13, 2021 1 hour ago, Mark Williams said: Sorry to have to say "ignorance"! Didn't know there was an INDY IMAP client. POP3 will work for Gmail, in that you can connect and download emails, but it just may not work the way you are expecting a typical POP3 server to behave. See: Read Gmail messages on other email clients using POP Gmail’s POP3 behavior Share this post Link to post
Mark Williams 14 Posted January 13, 2021 I'm just going to swerve it and use the IMAP component, which seems much fitter for purpose. Just grateful I hadn't invested too much time in Pop3 before hitting a snag. Share this post Link to post