diff options
author | Koni Marti <koni.marti@gmail.com> | 2024-01-17 16:43:03 +0100 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2024-01-19 23:32:01 +0100 |
commit | 65c0fb7820e1046ad3cbe012e1a291a9f6c4d224 (patch) | |
tree | 1cbc1c9d0a23409e0a74c2baf580e2359ce29f36 /app/compose.go | |
parent | 2d9d7e0bed87d11771a7264c08c02d110eef6751 (diff) | |
download | aerc-65c0fb7820e1046ad3cbe012e1a291a9f6c4d224.tar.gz |
compose: ensure rfc2045 compliant mime message
Ensure that the encrypted and/or signed messages contain a correct
MIME-Version header field at the top level of the message in compliance
with RFC2045 Section 4.
Link: https://datatracker.ietf.org/doc/html/rfc2045#section-4
Link: https://lists.sr.ht/~rjarry/aerc-discuss/%3C1704071512-sup-2798%40honeycomb%3E
Reported-by: Dan Callaghan <djc@djc.id.au>
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'app/compose.go')
-rw-r--r-- | app/compose.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/compose.go b/app/compose.go index 43ca6610..a54f534b 100644 --- a/app/compose.go +++ b/app/compose.go @@ -945,6 +945,14 @@ func (c *Composer) WriteMessage(header *mail.Header, writer io.Writer) error { } } + if header != nil && !header.Has("MIME-Version") { + // sign and encrypt will create multipart/* messages + // without setting the MIME-Version header. Set it + // manually at the top level to be compliant with RFC + // 2045. + header.Set("MIME-Version", "1.0") + } + if c.encrypt { rcpts, err := getRecipientsEmail(c) if err != nil { |