Open iredmail opened 3 years ago
Just don't try customize messages, they aren't shown anywhere to the user.
How about the first request, easier / clearer SMTP response?
This also sounds like customization.
But why doesn't allow developers to customize SMTP response?
Reasonable? :)
In both of these cases you don't reply 250, right?
In both of these cases you don't reply 250, right?
Yes, and 4xx, 5xx smtp code should end the smtp session.
If you're hitting an error, returning an SMTPError
is fine. If you're not hitting an error, return a nil error.
We return 4xx/5xx on purpose. For example:
For first case, it's not an "error" like "disk is full", but we still need to reject the session.
My suggestion is: Add a new struct SMTPReply
, which is same as SMTPError
. The word "Error" in struct name SMTPError
is some kind of confusing, and it introduces a concern that the internal process to handle an error may be not what developers want. We handle a lot errors in Golang, but this SMTPError
is just a normal smtp reply to end the session.
Session
interface have to returnsmtp.SMTPError{...}
to customize returned smtp code and message. Although it's ok to set smtp code250
for normal exit withSMTPError{...}
, but will the logic of handlingSMTPError
change internally ingo-smtp
someday? Should we separate a normal exit (with custom return message) and error (e.g.SMTPResponse
and existingSMTPError)
? Should we expose something likeconn.WriteResponse()
?No way to customize the greeting text. We'd like to customize it and display our product name. https://github.com/emersion/go-smtp/blob/master/conn.go#L937
How about add a new attribute like
Banner
inServer
struct for this purpose, with default value set to currentfmt.Sprintf("%v ESMTP Service Ready", c.server.Domain)
. PR #132 fixes this.Postfix MTA uses parameter
smtpd_banner
for this greeting text, so i thinkBanner
should be fine.