mirror of
https://github.com/Floriansylvain/RenewCMS.git
synced 2026-08-19 11:43:22 +02:00
refac: fixed, better, smarter, correct dependency injection
This commit is contained in:
@@ -4,11 +4,12 @@ import (
|
||||
"GoCMS/domain/gateways"
|
||||
"bytes"
|
||||
"embed"
|
||||
"gopkg.in/gomail.v2"
|
||||
"html/template"
|
||||
"log"
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
"gopkg.in/gomail.v2"
|
||||
)
|
||||
|
||||
type MailRepository struct{}
|
||||
@@ -16,7 +17,11 @@ type MailRepository struct{}
|
||||
//go:embed mail/templates/*
|
||||
var mailTemplateFiles embed.FS
|
||||
|
||||
func (m MailRepository) Send(receiverAddress string, templateName string, data interface{}) error {
|
||||
func NewMailRepository() *MailRepository {
|
||||
return &MailRepository{}
|
||||
}
|
||||
|
||||
func (m MailRepository) Send(receiverAddress string, templateName string, data any) error {
|
||||
from := os.Getenv("SMTP_EMAIL")
|
||||
password := os.Getenv("SMTP_PASSWORD")
|
||||
smtpHost := os.Getenv("SMTP_HOST")
|
||||
|
||||
Reference in New Issue
Block a user