✅ [Dot Net Tutorials] Email Confirmation E-Mail doesnt work

Hello, I'm currently following this Tutorial but everytime I click on the "Register" button to register the Account I get the following error: Someone here who can help me there?
Dot Net Tutorials
Dot Net Tutorials
Email Confirmation in ASP.NET Core Identity
In this article, I will discuss Email Confirmation in ASP.NET Core Identity, i.e., How to Confirm Email in ASP.NET Core Identity.
No description
17 Replies
Jimmacle
Jimmacle7mo ago
did you do this part?
No description
Kasumi (Deactivated Account)
Yes Did all previous parts
Salman
Salman7mo ago
can you share your code as well
Kasumi (Deactivated Account)
Like share the zip?
Salman
Salman7mo ago
no I mean only the relevant code using $paste
MODiX
MODiX7mo ago
If your code is too long, you can post to https://paste.mod.gg/, save, and copy the link into chat for others to see your shared code!
Kasumi (Deactivated Account)
Ah okay
Kasumi (Deactivated Account)
BlazeBin - jbqelyczwdph
A tool for sharing your source code with the world!
Jimmacle
Jimmacle7mo ago
i suspect you have to register your email service as an IEmailSender, not its own type
Salman
Salman7mo ago
you aren't injecting EmailSender service in your constructor btw:
public AccountController(UserManager<ApplicationUser> userManager, SignInManager<ApplicationUser> signInManager)
{
this._userManager = userManager;
this.signInManager = signInManager;
this.emailSender = emailSender;
}
public AccountController(UserManager<ApplicationUser> userManager, SignInManager<ApplicationUser> signInManager)
{
this._userManager = userManager;
this.signInManager = signInManager;
this.emailSender = emailSender;
}
Kasumi (Deactivated Account)
Huh? Oh yea
Salman
Salman7mo ago
public AccountController(UserManager<ApplicationUser> userManager, SignInManager<ApplicationUser> signInManager, EmailSenderService emailSender)
{
this._userManager = userManager;
this.signInManager = signInManager;
this.emailSender = emailSender;
}
public AccountController(UserManager<ApplicationUser> userManager, SignInManager<ApplicationUser> signInManager, EmailSenderService emailSender)
{
this._userManager = userManager;
this.signInManager = signInManager;
this.emailSender = emailSender;
}
so probably that's why you were getting a NRE because your emailSender was never instantiated so
Kasumi (Deactivated Account)
Oh yea I'm dumb :kitty_dead: Well tbh its late and in hurry :shyySweat:
Salman
Salman7mo ago
Also btw you should follow the official MS Learn docs instead of sites like that, the problem is that these APIs might change so you should stay up to date. Like if you are using MVC you should look into the official docs of MVC Identity etc. However if this works for now then keep going
Kasumi (Deactivated Account)
I know, did that too but I'm in hella hurry and the MS Learn Docs are very time instensive and doesnt really include everything in one like they do But thank you guys :love_bun:
Salman
Salman7mo ago
$close
MODiX
MODiX7mo ago
If you have no further questions, please use /close to mark the forum thread as answered

Did you find this page helpful?