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
|
smtpPass string
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(smtpHost string, smtpPort string, smtpUser string, smtpPass string) Mailer {
|
func New() Mailer {
|
||||||
return Mailer{
|
return Mailer{
|
||||||
smtpHost: smtpHost,
|
smtpHost: os.Getenv("SMTP_HOST"),
|
||||||
smtpPort: smtpPort,
|
smtpPort: os.Getenv("SMTP_PORT"),
|
||||||
smtpUser: smtpUser,
|
smtpUser: os.Getenv("SMTP_USER"),
|
||||||
smtpPass: smtpPass,
|
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 {
|
func getTemplate(templateName string) string {
|
||||||
templatePath := "templates/" + templateName + ".gotmpl"
|
templatePath := "templates/mail/" + templateName + ".gotmpl"
|
||||||
content, err := os.ReadFile(templatePath)
|
content, err := os.ReadFile(templatePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("Error leyendo plantilla: %v\n", err)
|
fmt.Printf("Error leyendo plantilla: %v\n", err)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user