C
C#2mo ago
Kasumi

✅ [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
Jimmacle2mo ago
did you do this part?
No description
Kasumi
KasumiOP2mo ago
Yes Did all previous parts
Salman
Salman2mo ago
can you share your code as well
Kasumi
KasumiOP2mo ago
Like share the zip?
Salman
Salman2mo ago
no I mean only the relevant code using $paste
MODiX
MODiX2mo 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
KasumiOP2mo ago
Ah okay
Kasumi
KasumiOP2mo ago
BlazeBin - jbqelyczwdph
A tool for sharing your source code with the world!
Jimmacle
Jimmacle2mo ago
i suspect you have to register your email service as an IEmailSender, not its own type
Salman
Salman2mo 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
KasumiOP2mo ago
Huh? Oh yea
Salman
Salman2mo 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
KasumiOP2mo ago
Oh yea I'm dumb :kitty_dead: Well tbh its late and in hurry :shyySweat:
Salman
Salman2mo 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
KasumiOP2mo ago
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
Salman2mo ago
$close
MODiX
MODiX2mo ago
If you have no further questions, please use /close to mark the forum thread as answered

Did you find this page helpful?