I have recently been working on an ASP.Net MVC project where I need to trigger an action when a new email comes to my Gmail (or any other email service provider) email server.
The action I need to trigger is already implemented as a class method. And I have already made up a solution which will check for new emails (in the mail server using the Google APIs) when a user calls the method. But I want this to 'trigger' automatically.
Is there an asynchronous event handler where I can constantly check for new emails in the background and the method gets triggered when a new email pops up (e.g. SignalR)? I don't want to make use of any time-based solution like task scheduler as this will consume application pools and is ineffective. Any solutions?