24 lines
823 B
Plaintext
24 lines
823 B
Plaintext
Implementa internal/mailer.
|
|
|
|
Requisiti:
|
|
- directory template email: /web/emails/templates
|
|
- verify_email.html + .txt
|
|
- reset_password.html + .txt
|
|
|
|
- internal/mailer/templates.go:
|
|
- carica e renderizza template (html+txt) con dati: AppName, BaseURL, VerifyURL/ResetURL, UserEmail.
|
|
|
|
- internal/mailer/mailer.go:
|
|
- interfaccia Mailer { Send(ctx, to, subject, htmlBody, textBody) error }
|
|
- factory NewMailer(cfg) che ritorna:
|
|
- sink mailer se cfg.Env==develop
|
|
- smtp mailer altrimenti
|
|
|
|
- internal/mailer/sink.go:
|
|
- salva in cfg.EmailSinkDir file con timestamp__type__to.eml (o .txt/.html)
|
|
- includi subject, to, bodies e link.
|
|
|
|
- internal/mailer/smtp.go:
|
|
- invio via SMTP usando cfg.SMTPHost/Port/User/Password/From/FromName.
|
|
|
|
Aggiorna README con “in develop le email sono salvate in ./data/emails”. |