How to send email from Asp.net Mvc-3?

后端 未结 9 1738
太阳男子
太阳男子 2020-12-23 09:50

How to send a mail through mvc-3 asp.net using c#?

I have to send a forgot password so how can I do this? My code is below.

Model code..

 usi         


        
9条回答
  •  时光取名叫无心
    2020-12-23 10:17

    It look like you are trying to send emails through GMail's SMTP service, which this SO question already covers: Sending email in .NET through Gmail

    The only thing that looks missing in your code is that you've set client.UseDefaultCredentials = true, I think you want to set this to false and provide your own credentials. I've never tried using GMail to send through emails, but I'm guessing you'll need to use a GMail account as your credentials in order to authenticate properly.

提交回复
热议问题