From e81ed7af2641b842a7cfc04588332275dee3e6cd Mon Sep 17 00:00:00 2001 From: Mechiel Lukkien Date: Fri, 16 Jun 2023 09:55:45 +0200 Subject: [PATCH] in DSN, don't add a comment with a nil IP address if we don't have an IP --- dsn/dsn.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dsn/dsn.go b/dsn/dsn.go index d7d0f47..f15991e 100644 --- a/dsn/dsn.go +++ b/dsn/dsn.go @@ -262,7 +262,11 @@ func (m *Message) Compose(log *mlog.Log, smtputf8 bool) ([]byte, error) { status("Status", statusLine) // ../rfc/3464:975 if !r.RemoteMTA.IsZero() { // ../rfc/3464:1015 - status("Remote-MTA", fmt.Sprintf("dns;%s (%s)", r.RemoteMTA.Name, smtp.AddressLiteral(r.RemoteMTA.IP))) + s := "dns;" + r.RemoteMTA.Name + if len(r.RemoteMTA.IP) > 0 { + s += " (" + smtp.AddressLiteral(r.RemoteMTA.IP) + ")" + } + status("Remote-MTA", s) } // Presence of Diagnostic-Code indicates the code is from Remote-MTA. ../rfc/3464:1053 if r.DiagnosticCode != "" {