@@ -37,6 +37,7 @@ type errorState struct {
37
37
}
38
38
39
39
func main () {
40
+ logrus .SetLevel (logrus .DebugLevel )
40
41
errorChannel := make (chan errorState )
41
42
go serveSPA (errorChannel )
42
43
go serveSSE (errorChannel )
@@ -72,7 +73,10 @@ func serveSMTP(errorChannel chan errorState) {
72
73
AuthHandler : func (remoteAddr net.Addr , mechanism string , username []byte , password []byte , shared []byte ) (bool , error ) {
73
74
return true , nil
74
75
},
75
- AuthMechs : map [string ]bool {"PLAIN" : true , "LOGIN" : true },
76
+ LogWrite : func (remoteIP , verb , line string ) {
77
+ logrus .WithField ("ip" , remoteIP ).WithField ("verb" , verb ).Debug (line )
78
+ },
79
+ AuthMechs : map [string ]bool {"PLAIN" : true , "LOGIN" : true , "CRAM-MD5" : false },
76
80
}
77
81
logrus .WithField ("Address" , addr ).Info ("Starting SMTP server" )
78
82
err := srv .ListenAndServe ()
@@ -144,7 +148,8 @@ func serveSSE(errorChannel chan errorState) {
144
148
func serveIMAP (errorChannel chan errorState ) {
145
149
be := imap .NewBackend ()
146
150
s := server .New (be )
147
- s .Debug = os .Stdout
151
+ imapLogger := logrus .New ()
152
+ s .Debug = imapLogger .Writer ()
148
153
s .Addr = listenOnAddress + ":1143"
149
154
s .AllowInsecureAuth = true
150
155
logrus .WithField ("Address" , s .Addr ).Info ("Starting IMAP server" )
0 commit comments