diff --git a/conn.go b/conn.go index fdd4de1..a4e9060 100644 --- a/conn.go +++ b/conn.go @@ -411,7 +411,7 @@ func (c *Conn) handleData(arg string) { err := c.User().Send(c.msg.From, c.msg.To, c.msg.Reader) io.Copy(ioutil.Discard, c.msg.Reader) // Make sure all the data has been consumed if err != nil { - if smtperr, ok := err.(*smtpError); ok { + if smtperr, ok := err.(*SMTPError); ok { code = smtperr.Code msg = smtperr.Message } else { diff --git a/data.go b/data.go index 8591e48..ae09f66 100644 --- a/data.go +++ b/data.go @@ -4,16 +4,17 @@ import ( "io" ) -type smtpError struct { +// SMTPError specifies the error code and message that needs to be returned to the client +type SMTPError struct { Code int Message string } -func (err *smtpError) Error() string { +func (err *SMTPError) Error() string { return err.Message } -var ErrDataTooLarge = &smtpError{ +var ErrDataTooLarge = &SMTPError{ Code: 552, Message: "Maximum message size exceeded", }