From 7f28a197493a33c96a07e335038c071386fc830f Mon Sep 17 00:00:00 2001 From: jinnrry Date: Wed, 1 Nov 2023 17:21:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dhelo=E6=A0=87=E8=AF=86?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/config/config.go | 2 +- server/http_server/http_server.go | 3 +-- server/http_server/https_server.go | 3 +-- server/http_server/setup_server.go | 3 ++- server/utils/smtp/smtp.go | 8 +++++++- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/server/config/config.go b/server/config/config.go index b62e6ea..5fc0787 100644 --- a/server/config/config.go +++ b/server/config/config.go @@ -38,7 +38,7 @@ type Config struct { //go:embed tables/* var tableConfig embed.FS -const Version = "2.2.6" +const Version = "2.2.7" const DBTypeMySQL = "mysql" const DBTypeSQLite = "sqlite" diff --git a/server/http_server/http_server.go b/server/http_server/http_server.go index a5430f5..676b216 100644 --- a/server/http_server/http_server.go +++ b/server/http_server/http_server.go @@ -29,8 +29,6 @@ func HttpStart() { HttpPort = config.Instance.HttpPort } - log.Infof("HttpServer Start On Port :%d", HttpPort) - if config.Instance.HttpsEnabled != 2 { mux.HandleFunc("/", controllers.Interceptor) httpServer = &http.Server{ @@ -66,6 +64,7 @@ func HttpStart() { mux.HandleFunc("/api/rule/del", contextIterceptor(controllers.DelRule)) mux.HandleFunc("/attachments/", contextIterceptor(controllers.GetAttachments)) mux.HandleFunc("/attachments/download/", contextIterceptor(controllers.Download)) + log.Infof("HttpServer Start On Port :%d", HttpPort) httpServer = &http.Server{ Addr: fmt.Sprintf(":%d", HttpPort), Handler: session.Instance.LoadAndSave(mux), diff --git a/server/http_server/https_server.go b/server/http_server/https_server.go index 7d9e466..705b153 100644 --- a/server/http_server/https_server.go +++ b/server/http_server/https_server.go @@ -72,9 +72,8 @@ func HttpsStart() { HttpsPort = config.Instance.HttpsPort } - log.Infof("Https Server Start On Port :%d", HttpsPort) - if config.Instance.HttpsEnabled != 2 { + log.Infof("Https Server Start On Port :%d", HttpsPort) httpsServer = &http.Server{ Addr: fmt.Sprintf(":%d", HttpsPort), Handler: session.Instance.LoadAndSave(mux), diff --git a/server/http_server/setup_server.go b/server/http_server/setup_server.go index 60cf002..603c0c4 100644 --- a/server/http_server/setup_server.go +++ b/server/http_server/setup_server.go @@ -2,6 +2,7 @@ package http_server import ( "fmt" + log "github.com/sirupsen/logrus" "io/fs" "net/http" "pmail/config" @@ -29,7 +30,7 @@ func SetupStart() { if config.Instance != nil && config.Instance.HttpPort > 0 { HttpPort = config.Instance.HttpPort } - + log.Infof("HttpServer Start On Port :%d", HttpPort) setupServer = &http.Server{ Addr: fmt.Sprintf(":%d", HttpPort), Handler: mux, diff --git a/server/utils/smtp/smtp.go b/server/utils/smtp/smtp.go index 68f4ba7..7fba2e8 100644 --- a/server/utils/smtp/smtp.go +++ b/server/utils/smtp/smtp.go @@ -28,6 +28,7 @@ import ( "net" "net/smtp" "net/textproto" + "pmail/config" "strings" "time" ) @@ -88,7 +89,12 @@ func NewClient(conn net.Conn, host string) (*Client, error) { text.Close() return nil, err } - c := &Client{Text: text, conn: conn, serverName: host, localName: "jinnrry.com"} + localName := "domain.com" + if config.Instance != nil && config.Instance.Domain != "" { + localName = config.Instance.Domain + } + + c := &Client{Text: text, conn: conn, serverName: host, localName: localName} _, c.tls = conn.(*tls.Conn) return c, nil }