I am developing an application in ASP.Net MVC, one of the requirements is reset password functionality, i cant figure out how to send password recovery email so a user can reset password.
Here is my code in the web config:
<system.net>
<mailSettings>
<smtp from="from@gmail.com">
<network host="smtp.gmail.com" defaultCredentials="false" password="password" port="587" enableSsl="true" />
</smtp>
</mailSettings>
</system.net>
Here is my EmailService class in the IdentityConfig.cs:
public class EmailService : IIdentityMessageService
{
public Task SendAsync(IdentityMessage message)
{
// Plug in your email service here to send an email.
SmtpClient client = new SmtpClient();
return client.SendMailAsync("email from web config",
message.Destination,
message.Subject,
message.Body);
}
}
This doesn't send email, i don't know what might the problem, hope someone can help.