mscdex / node-imap

An IMAP client module for node.js.
MIT License
2.17k stars 380 forks source link

Issue with Gmail All Mail Box #588

Open bilalrazamoon opened 7 years ago

bilalrazamoon commented 7 years ago

Hi @mscdex,

I'm trying to reduce connections by registering on Gmail All Mail Box as I understand Inbox, Sent, Draft boxes and custom labels are in one All Mail Box . but, when I archive mail from inbox or move to inbox from sent changes, Gmail All mail box not emitting update event except read/unread or flagged/un-flagged changes.

Thanks.

rickhall commented 7 years ago

I think that makes sense, since adding/remove labels in Gmail doesn't really have any impact on the All Mail mailbox. For example, archiving mail simply removes other labels, it doesn't add the message to All Mail since the message is already there to begin with. Same thing with moving to inbox, it just adds a label.

Gmail is an odd IMAP server, since messages always exists in All Mail (until completely expunged), regardless of which other mailboxes the message is in.

bilalrazamoon commented 7 years ago

But If I want to sync All Mail Box's mails with my developed mail client, what should I do?

rickhall commented 7 years ago

Well, if you've already synced All Mail then it will already be synced. As I pointed out, archiving mail or moving from inbox does not impact the contents of All Mail. Conceptually, those operations impact the "other" mailbox the message was in.

From what I can understand, it sounds like you are trying to keep (for example) INBOX synced by listening for events on All Mail. That's not possible. You either have to have INBOX opened and be listening for events on INBOX or you have to resync it occasionally.

Granted, I'm no expert, but that's my understanding.

mscdex commented 7 years ago

That sounds about right. Gmail's IMAP implementation does stray from traditional IMAP implementations in many ways, so this is not surprising.