From f322a7127ad9e2d742e30cc463bb90ef67b18d21 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 12 Dec 2016 02:01:03 -0500 Subject: [PATCH] Support SMTP along with ESMTP. --- smtp/conn.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/smtp/conn.go b/smtp/conn.go index 30d48f8..f29b198 100644 --- a/smtp/conn.go +++ b/smtp/conn.go @@ -41,7 +41,7 @@ func AcceptConnection(netConn net.Conn, server Server) error { var err error - conn.writeReply(250, fmt.Sprintf("%s ESMTP [%s] mailpopbox", server.Name(), netConn.LocalAddr().String())) + conn.writeReply(250, fmt.Sprintf("%s ESMTP [%s] (mailpopbox)", server.Name(), netConn.LocalAddr())) for { conn.line, err = conn.tp.ReadLine() @@ -110,7 +110,15 @@ func (conn *connection) doEHLO() { return } - conn.writeReply(250, fmt.Sprintf("Hello %s, I am glad to meet you", conn.ehlo)) + if cmd == "HELO" { + conn.writeReply(250, fmt.Sprintf("Hello %s [%s]", conn.ehlo, conn.remoteAddr)) + } else { + conn.tp.PrintfLine("250-Hello %s [%s]", conn.ehlo, conn.remoteAddr) + if conn.server.TLSConfig() != nil { + conn.tp.PrintfLine("250-STARTTLS") + } + conn.tp.PrintfLine("250 SIZE %d", 40960000) + } conn.state = stateInitial } -- 2.22.5