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
fixed "myhostname=mail.example.com" still exists error
Jackb27fe063f951
diff --git a/core/internal/service/domains/domains.go b/core/internal/service/domains/domains.goindex c1922555..5995a3a9 100644--- a/core/internal/service/domains/domains.go+++ b/core/internal/service/domains/domains.go@@ -38,24 +38,11 @@ func Add(ctx context.Context, domain *v1.Domain) error {return fmt.Errorf("failed to update BILLIONMAIL_HOSTNAME in .env file: %v", err)}- // update postfix main.cf myhostname- mainCFPath := public.AbsPath(consts.POSTFIX_MAIN_CONF)-- content, err := public.ReadFile(mainCFPath)-- if err != nil {- return fmt.Errorf("failed to read postfix main.cf: %v", err)- }-- // replace the hostname in the content- content = strings.ReplaceAll(content, "myhostname = ", fmt.Sprintf("myhostname = %s", public.FormatMX(domain.Domain)))- content = strings.ReplaceAll(content, "myhostname = mail.example.com", fmt.Sprintf("myhostname = %s", public.FormatMX(domain.Domain)))-- // write the updated content back to the file- _, err = public.WriteFile(mainCFPath, content)+ // update postfix environment parameter+ _, err = public.DockerApiFromCtx(ctx).ExecCommandByName(ctx, "billionmail-postfix-billionmail-1", []string{"BILLIONMAIL_HOSTNAME=" + public.FormatMX(domain.Domain)}, "root")if err != nil {- return fmt.Errorf("failed to write postfix main.cf: %v", err)+ return fmt.Errorf("failed to update BILLIONMAIL_HOSTNAME in postfix container: %v", err)}// restart postfix service