email: remove content headers of passed-in message

The email has already been parsed according to the headers, but they are
still present. However, signing or encrypting the email will change the
content format, so remove any such headers before continuing.
This commit is contained in:
Conrad Hoffmann 2023-02-27 16:47:21 +01:00 committed by Drew DeVault
parent 144fc447a3
commit 78b6f7232a
1 changed files with 5 additions and 0 deletions

View File

@ -99,6 +99,11 @@ func EnqueueStd(ctx context.Context, header mail.Header,
rcpts = append(rcpts, addr.Address)
}
// Disallow content headers, signing/encrypting will change this
header.Del("Content-Transfer-Encoding")
header.Del("Content-Type")
header.Del("Content-Disposition")
if !header.Has("Message-Id") {
header.GenerateMessageID()
}