writeThreadingHeaders writes the In-Reply-To and References headers per RFC 5322 § 3.6.4. References is the full ancestor chain in conversation order (oldest → newest) and must be space-separated message-ids; mail clients use it to anchor a reply to an existing thread by matching ANY id in the chain
(writeHeader func(string, string), replyToMsgID string, references []string)
| 235 | // non-empty references slice for any reply that may reach a recipient who |
| 236 | // did not see the immediate parent (multi-party / agent-mediated threads). |
| 237 | func writeThreadingHeaders(writeHeader func(string, string), replyToMsgID string, references []string) { |
| 238 | if replyToMsgID != "" { |
| 239 | writeHeader("In-Reply-To", replyToMsgID) |
| 240 | } |
| 241 | if len(references) > 0 { |
| 242 | writeHeader("References", strings.Join(references, " ")) |
| 243 | } else if replyToMsgID != "" { |
| 244 | writeHeader("References", replyToMsgID) |
| 245 | } |
| 246 | } |
| 247 | |
| 248 | func headerWriter(buf *strings.Builder) func(string, string) { |
| 249 | return func(key, value string) { |
no outgoing calls
no test coverage detected