Update mail.go

This commit is contained in:
Lizandro Guarnizo
2026-05-12 17:37:43 -05:00
parent 848cb1fcf5
commit 338cd03e4f
+6 -3
View File
@@ -31,10 +31,13 @@ func (m *Mail) Send(to string, subject string, body string, ccEmails ...string)
m.SetupMailer()
}
// Obtener el remitente desde el archivo .env
from := os.Getenv("MAIL_FROM_ADDRESS")
// Usar el remitente de la config activa; si está vacío, caer al env
from := m.FromAddress
if from == "" {
log.Println("Error: MAIL_FROM_ADDRESS no está configurado en el archivo .env")
from = os.Getenv("MAIL_FROM_ADDRESS")
}
if from == "" {
log.Println("Error: FromAddress no está configurado")
return fmt.Errorf("MAIL_FROM_ADDRESS no está configurado")
}