aboutsummaryrefslogtreecommitdiff
path: root/lmtp_server.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-04-01 13:36:30 +0800
committerRunxi Yu <me@runxiyu.org>2025-04-01 13:36:30 +0800
commit7c8e3f9dcfee3826dcf04aa3cb99453ba01331d7 (patch)
tree3819e089a29b463da5a1c47a5065cb873e7dc491 /lmtp_server.go
parentBasic debugging LMTP handler (diff)
downloadforge-7c8e3f9dcfee3826dcf04aa3cb99453ba01331d7.tar.gz
forge-7c8e3f9dcfee3826dcf04aa3cb99453ba01331d7.tar.zst
forge-7c8e3f9dcfee3826dcf04aa3cb99453ba01331d7.zip
LMTP configuration update
Diffstat (limited to 'lmtp_server.go')
-rw-r--r--lmtp_server.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/lmtp_server.go b/lmtp_server.go
index 8e574e4..041194e 100644
--- a/lmtp_server.go
+++ b/lmtp_server.go
@@ -11,6 +11,7 @@ import (
"log/slog"
"net"
"strings"
+ "time"
"github.com/emersion/go-message"
"github.com/emersion/go-smtp"
@@ -53,7 +54,14 @@ func (*lmtpHandler) NewSession(_ *smtp.Conn) (smtp.Session, error) {
}
func serveLMTP(listener net.Listener) error {
+ // TODO: Manually construct smtp.Server
smtpServer := smtp.NewServer(&lmtpHandler{})
+ smtpServer.LMTP = true
+ smtpServer.Domain = config.LMTP.Domain
+ smtpServer.Addr = config.LMTP.Socket
+ smtpServer.WriteTimeout = time.Duration(config.LMTP.WriteTimeout) * time.Second
+ smtpServer.ReadTimeout = time.Duration(config.LMTP.ReadTimeout) * time.Second
+ smtpServer.EnableSMTPUTF8 = true
return smtpServer.Serve(listener)
}