问题
I've been doing some research into how to get new email notification from gmail. From what I am reading it doesn't really seem to be possible.
Gmail API has no webhooks or anything that would allow to get new email notification. Also IMAP api doesn't seem to be able to, at least from what I'm reading, documentation is rather vague.
So, I guess I am asking is there a way to achieve receiving notification when new email arrives so we can process it when its received or is polling for new emails since last pol the only option.
I don't care in what language is potential library written that could make this possible.
Thanks in advance for any information!
回答1:
Check out this.
Gmail push notifications are now available and mean you don't need to poll anymore.
https://developers.google.com/gmail/api/guides/push
回答2:
IMAP IDLE will notify you of new messages:
1 LOGIN rfs9999 "XXXX"
* OK Gimap ready for requests from xx.xx.xx.xx u10mb3060044oek
2 IDLE
+ idling
When new messages arrives you'll be notified:
* 7541 EXISTS
* 7542 EXISTS
-Rick
来源:https://stackoverflow.com/questions/29438613/gmail-new-email-notification