consider all smtp errors as warnings

This commit is contained in:
Aine
2024-02-21 09:46:46 +02:00
parent 7ad686937c
commit ba1a8c8390

View File

@@ -3,9 +3,7 @@ package smtp
import ( import (
"context" "context"
"crypto/tls" "crypto/tls"
"fmt"
"net" "net"
"strings"
"sync" "sync"
"time" "time"
@@ -93,12 +91,7 @@ func NewManager(cfg *Config) *Manager {
s := smtp.NewServer(mailsrv) s := smtp.NewServer(mailsrv)
s.ErrorLog = loggerWrapper{func(s string, i ...any) { s.ErrorLog = loggerWrapper{func(s string, i ...any) {
msg := fmt.Sprintf(s, i...) cfg.Logger.Warn().Msgf(s, i...)
if strings.Contains(msg, "connection reset by peer") {
cfg.Logger.Warn().Msg(msg)
return
}
cfg.Logger.Error().Msg(msg)
}} }}
s.ReadTimeout = 10 * time.Second s.ReadTimeout = 10 * time.Second
s.WriteTimeout = 10 * time.Second s.WriteTimeout = 10 * time.Second