38 lines
1.9 KiB
Markdown
38 lines
1.9 KiB
Markdown
# Integrazione Supporto Resend per Invio Email
|
|
|
|
## Obiettivo
|
|
Abilitare l'invio di email tramite servizi terzi (Resend) oltre al già presente SMTP, con configurazione via interfaccia grafica.
|
|
|
|
## Stato Attuale
|
|
- Backend: `SmtpEmailSender` gestisce solo SMTP.
|
|
- Frontend: `SettingsPage` gestisce solo campi SMTP.
|
|
- DTO: `SmtpConfigDto` limitato a SMTP.
|
|
|
|
## Piano di Lavoro
|
|
1. **Backend DTO**: Aggiornare `SmtpConfigDto` con campi `Provider` e `ResendApiKey`.
|
|
2. **Backend Controller**: Aggiornare `CommunicationsController` per leggere/salvare le nuove configurazioni (`EMAIL_PROVIDER`, `RESEND_API_KEY`).
|
|
3. **Backend Service**: Modificare `SmtpEmailSender` (o rinominarlo in `UnifiedEmailSender`) per supportare la logica condizionale (SMTP vs Resend). Implementare l'invio tramite HTTP Client per Resend.
|
|
4. **Frontend Service**: Aggiornare le definizioni di tipo TypeScript.
|
|
5. **Frontend UI**: Modificare `SettingsPage` per aggiungere un selettore di provider (SMTP/Resend) e mostrare i campi pertinenti dinamicamente.
|
|
6. **Traduzioni**: Aggiungere le nuove etichette.
|
|
|
|
## Dettagli Tecnici
|
|
- **API Resend**: Richiesta POST a `https://api.resend.com/emails` con Bearer Token.
|
|
- **Provider Enum**: "smtp", "resend".
|
|
- **Defaut**: SMTP per retrocompatibilità.
|
|
|
|
## Avanzamento
|
|
- [x] Backend DTO Update (`SmtpConfigDto`)
|
|
- [x] Backend Controller Update (`CommunicationsController`)
|
|
- [x] Backend Service Logic (`SmtpEmailSender` now handles Resend via HTTP)
|
|
- [x] Frontend Types Update
|
|
- [x] Frontend UI Update (`SettingsPage.tsx` with Provider selector)
|
|
- [x] Dependencies (Added `Microsoft.Extensions.Http` to Infrastructure)
|
|
|
|
## Note Finali
|
|
- L'integrazione supporta ora la selezione dinamica tra SMTP e Resend.
|
|
- La configurazione viene salvata su database (`EMAIL_PROVIDER`, `RESEND_API_KEY`).
|
|
- Il backend utilizza `IHttpClientFactory` per le chiamate API verso Resend.
|
|
- UI aggiornata per mostrare campi condizionali.
|
|
|