]>
src.bluestatic.org Git - mailpopbox.git/blob - smtp/server.go
12 type ReplyLine
struct {
17 func (l ReplyLine
) String() string {
18 return fmt
.Sprintf("%d %s", l
.Code
, l
.Message
)
22 ReplyOK
= ReplyLine
{250, "OK"}
23 ReplyBadSyntax
= ReplyLine
{501, "syntax error"}
24 ReplyBadSequence
= ReplyLine
{503, "bad sequence of commands"}
25 ReplyBadMailbox
= ReplyLine
{550, "mailbox unavailable"}
28 type Envelope
struct {
38 func WriteEnvelopeForDelivery(w io
.Writer
, e Envelope
) {
39 fmt
.Fprintf(w
, "Delivered-To: <%s>\r\n", e
.RcptTo
[0].Address
)
40 fmt
.Fprintf(w
, "Return-Path: <%s>\r\n", e
.MailFrom
.Address
)
44 type Server
interface {
46 TLSConfig() *tls
.Config
48 VerifyAddress(mail
.Address
) ReplyLine
49 OnMessageDelivered(Envelope
) *ReplyLine
52 type EmptyServerCallbacks
struct{}
54 func (*EmptyServerCallbacks
) TLSConfig() *tls
.Config
{
58 func (*EmptyServerCallbacks
) OnEHLO() *ReplyLine
{
62 func (*EmptyServerCallbacks
) VerifyAddress(mail
.Address
) ReplyLine
{
66 func (*EmptyServerCallbacks
) OnMessageDelivered(Envelope
) *ReplyLine
{