I have this code that sends email every time a new post is created. It sends an email to all users from the database with a certain link. The thing is, users can't (shouldn't) be allowed to view the post if they are not signed in. How do I make this in such a way that after I click on the link on the email, it redirects me to the log in page and then redirects me back to the original link from the email?
What's the approach to this?