fix mail for using env vars
This commit is contained in:
parent
b9356ae0e1
commit
049f366e2e
12
mail/mail.go
12
mail/mail.go
@ -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)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user