mirror of
https://github.com/mjl-/mox.git
synced 2025-07-12 11:44:38 +03:00
improve dsn handling
have the full smtp reply in the Diagnostic-Code field, not something that resembles it but isn't quite the same. include any additional error message in the Status field as comment. before, we ended up having an Diagnostic-Code that didn't include the original smtp code. it only had the enhanced error code.
This commit is contained in:
@ -226,6 +226,13 @@ func parseRecipientHeader(mr *textproto.Reader, utf8 bool) (Recipient, error) {
|
||||
case "Status":
|
||||
// todo: parse the enhanced status code?
|
||||
r.Status = v
|
||||
t := strings.SplitN(v, "(", 2)
|
||||
v = strings.TrimSpace(v)
|
||||
if len(t) == 2 && strings.HasSuffix(v, ")") {
|
||||
r.Status = strings.TrimSpace(t[0])
|
||||
r.StatusComment = strings.TrimSpace(strings.TrimSuffix(t[1], ")"))
|
||||
}
|
||||
|
||||
case "Remote-Mta":
|
||||
r.RemoteMTA = NameIP{Name: v}
|
||||
case "Diagnostic-Code":
|
||||
|
Reference in New Issue
Block a user