forked from phalaaxx/milter
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathinterface.go
49 lines (38 loc) · 1.65 KB
/
interface.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package milter
import (
"net"
"net/textproto"
)
// SessionHandler is an interface for milter callback handlers
type SessionHandler interface {
// Init is called on begin of a new Mail, before Connect() and before MailFrom()
// Can be used to Reset session state
// On MailFrom mailID is available
Init(sessionID, mailID string)
// Connect is called to provide SMTP connection data for incoming message
// supress with NoConnect
Connect(host string, family string, port uint16, addr net.IP, m *Modifier) (Response, error)
// Helo is called to process any HELO/EHLO related filters
// supress with NoHelo
Helo(name string, m *Modifier) (Response, error)
// MailFrom is called to process filters on envelope FROM address
// supress with NoMailForm
MailFrom(from string, m *Modifier) (Response, error)
// RcptTo is called to process filters on envelope TO address
// supress with NoRcptTo
RcptTo(rcptTo string, m *Modifier) (Response, error)
// Header is called once for each header in incoming message
// supress with NoHeaders
Header(name string, value string, m *Modifier) (Response, error)
// Headers is called when all message headers have been processed
// supress with NoHeaders
Headers(h textproto.MIMEHeader, m *Modifier) (Response, error)
// BodyChunk is called to process next message body chunk data (up to 64KB in size)
// supress with NoBody
BodyChunk(chunk []byte, m *Modifier) (Response, error)
// Body is called at the end of each message
// all changes to message's content & attributes must be done here
Body(m *Modifier) (Response, error)
// Disconnect is called at the end of the message Handling loop
Disconnect()
}