feat: Move mail system to shared
Server Deploy / deploy (push) Successful in 2m46s

This commit is contained in:
2026-07-28 09:50:46 +01:00
parent 5e326335af
commit a232c74990
49 changed files with 1206 additions and 706 deletions
+6 -5
View File
@@ -11,8 +11,8 @@ import (
"time"
"github.com/joho/godotenv"
"github.com/mrhid6/vantage/shared/mail"
"github.com/mrhid6/vantage/sitesvc/internal/api"
"github.com/mrhid6/vantage/sitesvc/internal/mail"
)
func main() {
@@ -21,9 +21,10 @@ func main() {
addr := ":" + getEnv("PORT", "8082")
mailCfg := mail.FromEnv()
if mailCfg.Enabled() {
log.Printf("smtp enabled (%s) contact form delivers to %s", mailCfg.Host, mailCfg.To)
sender := mail.FromEnv()
contactTo := getEnv("SMTP_TO", "support@hostxtra.co.uk")
if sender.Enabled() {
log.Printf("smtp enabled (%s) contact form delivers to %s", sender.Host, contactTo)
} else {
log.Println("warning: SMTP_HOST/SMTP_FROM not set the contact form will refuse submissions")
}
@@ -34,7 +35,7 @@ func main() {
srv := &http.Server{
Addr: addr,
Handler: api.New(mailCfg).Routes(),
Handler: api.New(sender, contactTo).Routes(),
ReadHeaderTimeout: 10 * time.Second,
ReadTimeout: 20 * time.Second,
WriteTimeout: 30 * time.Second,