fix mail for using env vars

This commit is contained in:
Pedro Pérez 2025-04-17 12:23:43 +02:00
parent b9356ae0e1
commit 049f366e2e

View File

@ -15,12 +15,12 @@ type Mailer struct {
smtpPass string
}
func New(smtpHost string, smtpPort string, smtpUser string, smtpPass string) Mailer {
func New() Mailer {
return Mailer{
smtpHost: smtpHost,
smtpPort: smtpPort,
smtpUser: smtpUser,
smtpPass: smtpPass,
smtpHost: os.Getenv("SMTP_HOST"),
smtpPort: os.Getenv("SMTP_PORT"),
smtpUser: os.Getenv("SMTP_USER"),
smtpPass: os.Getenv("SMTP_PASS"),
}
}
@ -45,7 +45,7 @@ func (m *Mailer) SendMail(to []string, templateName string, data interface{}) er
}
func getTemplate(templateName string) string {
templatePath := "templates/" + templateName + ".gotmpl"
templatePath := "templates/mail/" + templateName + ".gotmpl"
content, err := os.ReadFile(templatePath)
if err != nil {
fmt.Printf("Error leyendo plantilla: %v\n", err)