Browse Source

Merge pull request #42 from Jinnrry/hotfix-helo

修复helo标识错误
木木的木头 2 years ago
parent
commit
875228b886

+ 1 - 1
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"

+ 1 - 2
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),

+ 1 - 2
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),

+ 2 - 1
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,

+ 7 - 1
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
 }