fix(email): migrate ResendEmailService from SMTP to official Resend SDK#26
Closed
Morgana-Claw wants to merge 2 commits intodevelopfrom
Closed
fix(email): migrate ResendEmailService from SMTP to official Resend SDK#26Morgana-Claw wants to merge 2 commits intodevelopfrom
Morgana-Claw wants to merge 2 commits intodevelopfrom
Conversation
- Replace System.Net.Mail.SmtpClient with official Resend NuGet package (v0.2.2) - Register ResendClient in DI container with proper configuration - Add Resend package reference to Infrastructure csproj - Consolidate duplicate email sends in AuthApplication.RegisterAsync The old implementation used SMTP to connect to Resend (smtp.resend.com:465) which has known issues with .NET's deprecated SmtpClient. The official Resend SDK uses their REST API which is more reliable and supports all email features. All 114 tests pass.
…ed DI - Inject IServiceScopeFactory instead of IEmailService in AuthApplication - Create new scope in Task.Run to avoid accessing disposed scoped services - Add Microsoft.Extensions.Logging.Abstractions package for ILogger - Update unit tests to mock the scope factory chain The fire-and-forget Task.Run was accessing IEmailService (Scoped) after the request scope was disposed, causing the email service to fail silently. Using IServiceScopeFactory ensures a valid scope for the background task. All 94 tests pass.
Collaborator
Author
|
Superseded by PR #27. Resend SDK migration is already included in the develop branch. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problema
O email de boas-vindas não estava sendo enviado quando um usuário se registrava no endpoint de auth.
Causa Raiz
O estava usando (legado/deprecated) para enviar emails via SMTP do Resend (). Esta abordagem tem vários problemas:
Solução
Migração para o Resend .NET SDK oficial ( NuGet package v0.2.2), que usa a REST API do Resend.
Alterações
Como configurar
Adicione no :
Testes
✅ 114/114 testes passando