I want to send one mail to user whenever he/she register at my website.
I have created my gmail account for that, I've tried many samples from net but i'm not able to sent email yet.
Please help me in this regard.
Thanks, vicky
I want to send one mail to user whenever he/she register at my website.
I have created my gmail account for that, I've tried many samples from net but i'm not able to sent email yet.
Please help me in this regard.
Thanks, vicky
Here is my solution for it, first time posting an answer. Happy coding
In addition to fredo Answer to clear web.config section
Now add in web.config file
I found a very good article on a website https://askgif.com about using Gmail SMTP with C#, so am sharing with you : https://askgif.com/blog/122/seding-email-using-gmail-smtp-in-asp-net-mvc-application/
Create Gmail Class comprises of all needed data type and member function as below
Then just used the following code wherever you want to send the email to the required email account.
Hope this will help you. Mark as answer if this helps you.
Here is a Email class that can be used with ASP.NET MVC4 leveraging dependency injection. A full running sample application & unit tests that use this class can be found here in my github space https://github.com/fredo007/i6technology/tree/master/InsuranceSales.
I've also put together an article explaining methodology & use here http://prestoasp.net/how-to-send-email-using-gmail-smtp-in-an-asp-net-mvc-application/