dotnet / dotnet/aspnetcore

Identity Endpoints - Lifetime IEmailSender

Open
#51,289 3 comments 0 reactions 0 assignees View on GitHub
area-identity enhancement feature-identity-apis feature-identity-service
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 5h
Merged PRs (30d)
276

Description

> I don't know if this is an issue or not but just want to mention that no matter what _lifetime_ the `IEmailSender` is added by user, It will always be created once.

That is a good point. That's the way I made `MapIdentityApi` work prior to this PR, but it is different from the Identity UI razor pages. The default no-op implementation is registered as a singleton.

Do you think it's common to need or want services from the request scope? I guess it probably wouldn't hurt. It's just another parameter to pass around.

_Originally posted by @halter73 in https://github.com/dotnet/aspnetcore/issues/50301#issuecomment-1696365240_

---

After testing with a few email integrations, I noticed there were scoping issues for working with `FluentEmail` SMTP.

A custom MailKit SMTP mailer worked fine.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.