Update mail.go
This commit is contained in:
+6
-3
@@ -31,10 +31,13 @@ func (m *Mail) Send(to string, subject string, body string, ccEmails ...string)
|
|||||||
m.SetupMailer()
|
m.SetupMailer()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Obtener el remitente desde el archivo .env
|
// Usar el remitente de la config activa; si está vacío, caer al env
|
||||||
from := os.Getenv("MAIL_FROM_ADDRESS")
|
from := m.FromAddress
|
||||||
if from == "" {
|
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")
|
return fmt.Errorf("MAIL_FROM_ADDRESS no está configurado")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user