You can use Pub Sub API in your Google Cloud Project and attach a topic to your Gmail account. Create a topic and subscription and subscribe to that topic you created and add webhook in the subscription. After attaching topic to your Gmail account, You will be notified for every email sent or received.
Documentation: https://developers.google.com/gmail/api/guides/push
Reference Video: https://www.youtube.com/watch?v=cgxQPUyZAXk