How to implement email confirmation for MVC using Gmail

I’m developing a small MVC application and need help adding email confirmation. I want to utilize Gmail’s SMTP server to send out confirmation emails to users after they sign up. I’ve tried different tutorials but haven’t had any success. Since it’s a small project, I prefer not to use paid services like SendGrid. Can someone provide a straightforward guide on how to set this up? I specifically need details on the SMTP configuration and how to send these confirmation emails through my controller.

The authentication method got me at first. Google killed basic auth for Gmail SMTP, so you’ll need OAuth2 or app-specific passwords like others mentioned. But honestly, I’d skip System.Net.Mail and use MailKit instead - it handles Gmail’s auth way better and has solid async support. Don’t forget to hash your tokens before saving them to the database. Set up a cleanup job to clear expired tokens too. Gmail SMTP works fine for testing, but watch out for daily sending limits once your app scales.

ya, smtp.gmail.com is awsome for this! just make sure to use System.Net.Mail. also, don’t forget about expirations on those confirmation links! after 24 hrs, tokens should be dead to keep things secure. otherwise, everything should be smooth sailing!