I am using PHP - Codeigniter (Peeker Library) as back-end and using IMAP to fetch emails from multiple email addresses.
We have some complex search criteria to quer
why you are not using php imap ? it's simple and very fast compared with peeker library and php imap always get new email.
First of all, in IMAP, there is no requirement which would imply that FETCH BODYSTRUCTURE
would have transfer complete message data with attachments. Either your assumption is wrong, or your IMAP library has a grave bug, or you are using a wrong function here.
Second, you mentioned keeping track of UIDs but have not said anything about the UIDVALIDITY
. Read RFC 3501 to understand what it means. There is no way you could implement an application talking IMAP correctly without knowing the protocol. Further pointers are also given in RFC 4549.
Your third question is about asking for deleted or moved items. In baseline IMAP, you cannot do that. The only way to know what messages have been deleted and which are the new arrivals is to track the UIDs explicitly -- assuming the UIDVALIDITY
was given and did not change, you compare the list of UIDs since the last time with what you got now, and see which are new and which are gone. Again, read the RFCs, they contain answers to all of your questions as well as suggestions on how to optimize the synchronization process. There's also a thesis about IMAP which goes into much more detail on how to further improve the protocol chat and what extensions are relevant. This is not an easy project, though.