Sendemailasync method does not run

Asked

Viewed 47 times

0

Debugging saw that the method Sendemailasync of controller account does not run and returns no error, it is simply ignored, all the settings are correct userid, code and Protocol.

string code = await _userManager.GenerateEmailConfirmationTokenAsync(user.Id);  
var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);  
await _userManager.SendEmailAsync(user.Id, "Confirmar sua conta", "Confirme sua conta clicando <a href=\"" + callbackUrl + "\">aqui</a>");

someone knows what can be?

  • 1

    Do not put photo of your codes, because if we need to test we will have to write everything from scratch, so we can reproduce your problem copy your code and put it in a code block by clicking on Edit

  • 1

    thanks for the correction.

1 answer

0

For this you must implement the Sendemail class that is signed with the Isendemail interface, take advantage and see the dependency injection. That should solve your problem.

  • I decided by injecting Iidentitymessageservice into Accountcontroller, and solving the dependency with simple injector. So I was able to use the Emailservice class with the Sendasync method to send confirmation email.

  • If you are using the new Core template is just implement the class, if doing so solved great. Cavalry!!!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.