From ee2a79e746dd8682af0ab2f8044c6215770bb5bb Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Wed, 10 Jan 2024 12:17:01 +0100 Subject: [PATCH] mail: unset Message-Id if empty --- mail/header.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mail/header.go b/mail/header.go index 5ce7071..a69059f 100644 --- a/mail/header.go +++ b/mail/header.go @@ -356,7 +356,11 @@ func base36(input uint64) string { // SetMessageID sets the Message-ID field. id is the message identifier, // without the angle brackets. func (h *Header) SetMessageID(id string) { - h.Set("Message-Id", "<"+id+">") + if id != "" { + h.Set("Message-Id", "<"+id+">") + } else { + h.Del("Message-Id") + } } // SetMsgIDList formats a list of message identifiers. Message identifiers