GODT-1261: Fix building messages with long key

This commit is contained in:
Alexander Bilyak
2021-08-16 15:29:39 +02:00
parent e9e4d8c725
commit 1157e60972
2 changed files with 25 additions and 1 deletions

View File

@ -494,7 +494,10 @@ func toMessageHeader(hdr mail.Header) message.Header {
for key, val := range hdr {
for _, val := range val {
res.Add(key, val)
// Using AddRaw instead of Add to save key-value pair as byte buffer within Header.
// This buffer is used latter on in message writer to construct message and avoid crash
// when key length is more than 76 characters long.
res.AddRaw([]byte(key + ": " + val + "\r\n"))
}
}