feat: register T1 (pending, verify)
This commit is contained in:
1 parent
3c3f7c6194
commit
4e41d60142
29 files changed
+2162
-42
No files matched your search
@@ -8,7 +8,8 @@ import (
|
||||
)
|
||||
|
||||
type SmtpSettings struct {
|
||||
Email string
|
||||
Login string
|
||||
Sender string
|
||||
Password string
|
||||
Host string
|
||||
Port int
|
||||
@@ -61,7 +62,8 @@ func NewSettingsFromEnv() (Settings, error) {
|
||||
DBFile: os.Getenv("DB_FILE"),
|
||||
Port: os.Getenv("PORT"),
|
||||
Smtp: SmtpSettings{
|
||||
Email: os.Getenv("SMTP_EMAIL"),
|
||||
Login: os.Getenv("SMTP_LOGIN"),
|
||||
Sender: os.Getenv("SMTP_SENDER"),
|
||||
Password: os.Getenv("SMTP_PASSWORD"),
|
||||
Host: os.Getenv("SMTP_HOST"),
|
||||
Port: smtpPort,
|
||||
|
||||
@@ -23,12 +23,13 @@ func NewMailRepository(smtp config.SmtpSettings) *MailRepository {
|
||||
}
|
||||
|
||||
func (m MailRepository) Send(receiverAddress string, templateName string, data any) error {
|
||||
from := m.smtp.Email
|
||||
login := m.smtp.Login
|
||||
sender := m.smtp.Sender
|
||||
password := m.smtp.Password
|
||||
smtpHost := m.smtp.Host
|
||||
smtpPort := m.smtp.Port
|
||||
|
||||
d := gomail.NewDialer(smtpHost, smtpPort, from, password)
|
||||
d := gomail.NewDialer(smtpHost, smtpPort, login, password)
|
||||
|
||||
tmpl, err := template.ParseFS(mailTemplateFiles, "templates/"+templateName+".html")
|
||||
if err != nil {
|
||||
@@ -45,12 +46,9 @@ func (m MailRepository) Send(receiverAddress string, templateName string, data a
|
||||
|
||||
msg := gomail.NewMessage()
|
||||
msg.SetHeaders(map[string][]string{
|
||||
"From": {"RenewCMS <" + from + ">"},
|
||||
"To": {receiverAddress},
|
||||
"MIME-version": {"1.0"},
|
||||
"Content-Type": {"text/html"},
|
||||
"charset": {"UTF-8"},
|
||||
"Subject": {"RenewCMS | Action required"},
|
||||
"From": {"RenewCMS <" + sender + ">"},
|
||||
"To": {receiverAddress},
|
||||
"Subject": {"RenewCMS | Action required"},
|
||||
})
|
||||
msg.SetBody("text/html", body.String())
|
||||
|
||||
|
||||
Reference in new issue
Block a user