-
Notifications
You must be signed in to change notification settings - Fork 256
Expand file tree
/
Copy pathmain.go
More file actions
64 lines (46 loc) · 1015 Bytes
/
main.go
File metadata and controls
64 lines (46 loc) · 1015 Bytes
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package main
import (
"flag"
"io"
"log"
"os"
"github.com/emersion/go-smtp"
)
var addr = "127.0.0.1:1025"
func init() {
flag.StringVar(&addr, "l", addr, "Listen address")
}
type backend struct{}
func (bkd *backend) NewSession(c *smtp.Conn) (smtp.Session, error) {
return &session{}, nil
}
type session struct{}
func (s *session) AuthPlain(username, password string) error {
return nil
}
func (s *session) Mail(from string, opts *smtp.MailOptions) error {
return nil
}
func (s *session) Rcpt(to string, opts *smtp.RcptOptions) error {
return nil
}
func (s *session) Data(r io.Reader) error {
return nil
}
func (s *session) XForward(attrName, attrValue string) error {
return nil
}
func (s *session) Reset() {}
func (s *session) Logout() error {
return nil
}
func main() {
flag.Parse()
s := smtp.NewServer(&backend{})
s.Addr = addr
s.Domain = "localhost"
s.AllowInsecureAuth = true
s.Debug = os.Stdout
log.Println("Starting SMTP server at", addr)
log.Fatal(s.ListenAndServe())
}