Skip to content

BillionMail gives you open-source MailServer, NewsLetter, Email Marketing — fully self-hosted, dev-friendly, and free from monthly fees. Join the discord: https://discord.gg/asfXzBUhZr

Gets the address of the access

lotk16330ae1f3af
diff --git a/core/internal/controller/batch_mail/batch_mail_v1_api_templates_list.go b/core/internal/controller/batch_mail/batch_mail_v1_api_templates_list.go
index 29c1f77d..3681c51d 100644
--- a/core/internal/controller/batch_mail/batch_mail_v1_api_templates_list.go
+++ b/core/internal/controller/batch_mail/batch_mail_v1_api_templates_list.go
@@ -132,9 +132,7 @@ func (c *ControllerV1) ApiTemplatesList(ctx context.Context, req *v1.ApiTemplate
ips = append(ips, row.Ip)
}
item.IpWhitelist = ips
- serverIP, _ := public.GetServerIP()
- serverPort := public.GetServerPort(ctx)
- item.ServerAddresser = "https://" + serverIP + ":" + serverPort
+ item.ServerAddresser = public.GethostUrl()
}
res.Data.Total = total
diff --git a/core/internal/service/public/common.go b/core/internal/service/public/common.go
index c9c6befc..7a62dc95 100644
--- a/core/internal/service/public/common.go
+++ b/core/internal/service/public/common.go
@@ -2643,3 +2643,19 @@ func LoadEnvFile() (map[string]string, error) {
return envMap, nil
}
+
+func GethostUrl() string {
+ hostname := MustGetDockerEnv("BILLIONMAIL_HOSTNAME", "")
+ var hostUrl string
+ if hostname == "" || hostname == "mail.example.com" {
+ serverIP, _ := GetServerIP()
+ serverPort := MustGetDockerEnv("HTTPS_PORT", "443")
+ hostUrl = fmt.Sprintf("https://%s:%s/", serverIP, serverPort)
+ } else {
+ hostUrl = fmt.Sprintf("https://%s/", hostname)
+ }
+ g.Log().Warning(context.Background(), "BillionMail host URL: ", hostUrl)
+
+ //return hostUrl
+ return "https://192.168.66.124:82"
+}