This commit is contained in:
teddy
2025-04-18 21:36:12 +07:00
parent 90270a2ab8
commit 2a67bb260f
5 changed files with 70 additions and 59 deletions

30
config/mail-config.go Normal file
View File

@@ -0,0 +1,30 @@
package config
import (
"fmt"
"os"
"strconv"
)
type MailConfig struct {
SMTPHost string
SMTPPort int
SMTPSenderName string
AuthEmail string
AuthPassword string
}
func Mail() *MailConfig {
port, err := strconv.Atoi(os.Getenv("SMTP_PORT"))
if err != nil {
fmt.Println("error parsing to int", err.Error())
}
return &MailConfig{
SMTPHost: os.Getenv("SMTP_HOST"),
SMTPPort: port,
SMTPSenderName: os.Getenv("SMTP_SENDER"),
AuthEmail: os.Getenv("AUTH_EMAIL"),
AuthPassword: os.Getenv("AUTH_PASSWORD"),
}
}