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 bugs: 1. no SSL Info of domain list. 2. send email with 25 port still using default authentication.
Jackad78c45eb533
diff --git a/core/internal/service/domains/domains.go b/core/internal/service/domains/domains.goindex 6b7eec2b..95c73c88 100644--- a/core/internal/service/domains/domains.go+++ b/core/internal/service/domains/domains.go@@ -81,7 +81,7 @@ func Get(ctx context.Context, keyword string, page, pageSize int) ([]v1.Domain,wg.Add(1)go func(i int, domain v1.Domain) {defer wg.Done()- domains[i].CertInfo, _ = crt.GetSSLInfo("mail." + strings.TrimPrefix(domain.Domain, "mail."))+ domains[i].CertInfo, _ = crt.GetSSLInfo(domain.Domain)}(i, domain)}diff --git a/core/internal/service/mail_service/sending.go b/core/internal/service/mail_service/sending.goindex 325dcbef..10bb574a 100644--- a/core/internal/service/mail_service/sending.go+++ b/core/internal/service/mail_service/sending.go@@ -91,11 +91,27 @@ type EmailSender struct {Host string `json:"host" v:"required"` // SMTP server addressPort string `json:"port" v:"required"` // SMTP server portPassword string `json:"password" v:"required"` // SMTP password+ SNI string `json:"sni"` // SNI for TLSclient *smtp.Client // persistent SMTP client connectionmutex sync.Mutex // mutex for thread safetyconnected bool // connection status}+type customAuth struct {+ Username, Password string+}++func (a *customAuth) Start(server *smtp.ServerInfo) (string, []byte, error) {+ return "PLAIN", []byte("\x00" + a.Username + "\x00" + a.Password), nil+}++func (a *customAuth) Next(fromServer []byte, more bool) ([]byte, error) {+ if more {+ return nil, errors.New("unexpected server response")+ }+ return nil, nil+}+func NewEmailSender() *EmailSender {e := &EmailSender{Host: "localhost",@@ -105,6 +121,8 @@ func NewEmailSender() *EmailSender {if public.IsRunningInContainer() {e.Host = "postfix"+ // e.Port = "587"+ // e.SNI, _ = public.DockerEnv("BILLIONMAIL_HOSTNAME")}return e@@ -166,6 +184,7 @@ func (e *EmailSender) connectWithSSL() error {conn, err := tls.Dial("tcp", e.Host+":"+e.Port, &tls.Config{MinVersion: tls.VersionTLS12,InsecureSkipVerify: true,+ ServerName: e.SNI,})if err != nil {return fmt.Errorf("TLS dial: %w", err)@@ -197,14 +216,23 @@ func (e *EmailSender) connectPlain() error {// Check if STARTTLS is neededif e.Port == "587" {if err = client.StartTLS(&tls.Config{+ MinVersion: tls.VersionTLS12,InsecureSkipVerify: true,+ ServerName: e.SNI,}); err != nil {client.Close()return fmt.Errorf("SMTP STARTTLS: %w", err)}}- auth := smtp.PlainAuth("", e.Email, e.Password, e.Host)+ var auth smtp.Auth++ if e.Port == "25" {+ auth = &customAuth{e.Email, e.Password}+ } else {+ auth = smtp.PlainAuth("", e.Email, e.Password, e.Host)+ }+if err = client.Auth(auth); err != nil {client.Close()return fmt.Errorf("SMTP auth: %w", err)