From 1e8fc58b394bae4fe1c034d35c6bf667c45364e1 Mon Sep 17 00:00:00 2001 From: Shulhan Date: Tue, 15 Jan 2019 01:15:00 +0700 Subject: lib/smtp: add function Params to Extension interface The Params will return the list of argument that supported by extension. --- lib/smtp/extension.go | 5 +++++ lib/smtp/extension_dsn.go | 7 +++++++ lib/smtp/server.go | 1 + 3 files changed, 13 insertions(+) diff --git a/lib/smtp/extension.go b/lib/smtp/extension.go index 016d473e..6adcecc0 100644 --- a/lib/smtp/extension.go +++ b/lib/smtp/extension.go @@ -13,6 +13,11 @@ type Extension interface { // Name() string + // + // Params return the SMTP extension parameters. + // + Params() string + // // ValidateCommand validate the command parameters, if the extension // provide custom parameters. diff --git a/lib/smtp/extension_dsn.go b/lib/smtp/extension_dsn.go index b59429df..0de388cb 100644 --- a/lib/smtp/extension_dsn.go +++ b/lib/smtp/extension_dsn.go @@ -14,6 +14,13 @@ func (dsn *extDSN) Name() string { return "DSN" } +// +// Params return the SMTP extension parameters. +// +func (dns *extDSN) Params() string { + return "" +} + // // ValidateCommand validate command parameter for MAIL and RCPT. // diff --git a/lib/smtp/server.go b/lib/smtp/server.go index de226737..51080c7f 100644 --- a/lib/smtp/server.go +++ b/lib/smtp/server.go @@ -214,6 +214,7 @@ func (srv *Server) handleCommand(recv *receiver, cmd *Command) (err error) { body := make([]string, len(srv.Exts)) for x, ext := range srv.Exts { body[x] = ext.Name() + body[x] += " " + ext.Params() } if !recv.isAuthenticated { -- cgit v1.3