I have an ASP.NET MVC4 application. Suppose that I wanted to execute some code (such as emailing a user) 2 days after a user has signed up.

One way is to have code executed on every request which scans the database for users and their sign-up time and execute code based on that. This seems messy and it depends on people visiting the application frequently.

Another way is to write a separate application that runs on the server 24/7 and performs the checking itself, perhaps scanning the database at 12:00am every day and performing its own code.

What's the good way to go about this?