Skip to content

Commit

Permalink
Merge pull request #42 from Jinnrry/hotfix-helo
Browse files Browse the repository at this point in the history
修复helo标识错误
  • Loading branch information
Jinnrry authored Nov 1, 2023
2 parents 51e9147 + 7f28a19 commit 875228b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion server/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 1 addition & 2 deletions server/http_server/http_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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),
Expand Down
3 changes: 1 addition & 2 deletions server/http_server/https_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
3 changes: 2 additions & 1 deletion server/http_server/setup_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package http_server

import (
"fmt"
log "github.com/sirupsen/logrus"
"io/fs"
"net/http"
"pmail/config"
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 7 additions & 1 deletion server/utils/smtp/smtp.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"net"
"net/smtp"
"net/textproto"
"pmail/config"
"strings"
"time"
)
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 875228b

Please sign in to comment.