From a253e89bdae6ecc101eae190a2766a7eb1e9eb33 Mon Sep 17 00:00:00 2001 From: Tim Culverhouse Date: Wed, 25 May 2022 14:24:05 -0500 Subject: [PATCH] compose: prevent sending empty address list headers Aerc was sending empty address list header fields (specifically CC by default). This was causing DKIM failures in lists.sr.ht. RFC 5322 states that an address field should consist of the field name and one or more addresses, implying empty fields are not allowed. Signed-off-by: Tim Culverhouse Acked-by: Robin Jarry --- widgets/compose.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/widgets/compose.go b/widgets/compose.go index 8830d9d..6a342d4 100644 --- a/widgets/compose.go +++ b/widgets/compose.go @@ -952,6 +952,10 @@ func (he *headerEditor) storeValue() { val := he.input.String() switch strings.ToLower(he.name) { case "to", "from", "cc", "bcc": + if strings.TrimSpace(val) == "" { + // Don't set empty address list headers + return + } list, err := mail.ParseAddressList(val) if err == nil { he.header.SetAddressList(he.name, list)